mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
A better way of PiP aspect ratio handling on Wayland
This commit is contained in:
parent
cde5e89e42
commit
8c1bef929e
2 changed files with 6 additions and 27 deletions
|
@ -38,17 +38,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtGui/QWindow>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <private/qwidget_p.h>
|
||||
|
||||
#ifdef QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB
|
||||
// private QtWaylandClient headers are using keywords :(
|
||||
#ifdef QT_NO_KEYWORDS
|
||||
#define signals Q_SIGNALS
|
||||
#define slots Q_SLOTS
|
||||
#endif // QT_NO_KEYWORDS
|
||||
|
||||
#include <private/qwaylandeglwindow_p.h>
|
||||
#endif // QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
namespace Media {
|
||||
namespace View {
|
||||
|
@ -599,11 +590,6 @@ void PipPanel::handleResize(QSize size) {
|
|||
if (!Platform::IsWayland()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto d = dynamic_cast<QWidgetPrivate*>(rp()->rpPrivate());
|
||||
if (!d) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply aspect ratio.
|
||||
const auto max = std::max(size.width(), size.height());
|
||||
|
@ -622,15 +608,10 @@ void PipPanel::handleResize(QSize size) {
|
|||
size.height())
|
||||
: scaled;
|
||||
|
||||
d->data.crect = QRect(d->data.crect.topLeft(), normalized);
|
||||
|
||||
#ifdef QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB
|
||||
using QtWaylandClient::QWaylandEglWindow;
|
||||
if (const auto waylandEglWindow = dynamic_cast<QWaylandEglWindow*>(
|
||||
widget()->windowHandle()->handle())) {
|
||||
waylandEglWindow->ensureSize();
|
||||
}
|
||||
#endif // QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB
|
||||
setGeometry(QRect(widget()->geometry().topLeft(), normalized));
|
||||
QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(
|
||||
widget()->windowHandle(),
|
||||
widget()->windowHandle()->handle()->geometry());
|
||||
}
|
||||
|
||||
void PipPanel::handleScreenChanged(QScreen *screen) {
|
||||
|
|
|
@ -491,7 +491,6 @@ void start() {
|
|||
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||
qputenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION", "desktop-app-wayland-egl");
|
||||
qputenv("QT_WAYLAND_SHELL_INTEGRATION", "desktop-app-xdg-shell;xdg-shell");
|
||||
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||
|
||||
|
@ -631,7 +630,6 @@ void start() {
|
|||
|
||||
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||
InvokeQueued(qApp, [] {
|
||||
qunsetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION");
|
||||
qunsetenv("QT_WAYLAND_SHELL_INTEGRATION");
|
||||
});
|
||||
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||
|
|
Loading…
Add table
Reference in a new issue