A better way of PiP aspect ratio handling on Wayland
This commit is contained in:
parent
cde5e89e42
commit
8c1bef929e
|
@ -38,17 +38,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
#include <QtGui/QScreen>
|
#include <QtGui/QScreen>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <private/qwidget_p.h>
|
#include <qpa/qplatformwindow.h>
|
||||||
|
#include <qpa/qwindowsysteminterface.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
|
|
||||||
|
|
||||||
namespace Media {
|
namespace Media {
|
||||||
namespace View {
|
namespace View {
|
||||||
|
@ -600,11 +591,6 @@ void PipPanel::handleResize(QSize size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto d = dynamic_cast<QWidgetPrivate*>(rp()->rpPrivate());
|
|
||||||
if (!d) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply aspect ratio.
|
// Apply aspect ratio.
|
||||||
const auto max = std::max(size.width(), size.height());
|
const auto max = std::max(size.width(), size.height());
|
||||||
const auto scaled = (_ratio.width() > _ratio.height())
|
const auto scaled = (_ratio.width() > _ratio.height())
|
||||||
|
@ -622,15 +608,10 @@ void PipPanel::handleResize(QSize size) {
|
||||||
size.height())
|
size.height())
|
||||||
: scaled;
|
: scaled;
|
||||||
|
|
||||||
d->data.crect = QRect(d->data.crect.topLeft(), normalized);
|
setGeometry(QRect(widget()->geometry().topLeft(), normalized));
|
||||||
|
QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(
|
||||||
#ifdef QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB
|
widget()->windowHandle(),
|
||||||
using QtWaylandClient::QWaylandEglWindow;
|
widget()->windowHandle()->handle()->geometry());
|
||||||
if (const auto waylandEglWindow = dynamic_cast<QWaylandEglWindow*>(
|
|
||||||
widget()->windowHandle()->handle())) {
|
|
||||||
waylandEglWindow->ensureSize();
|
|
||||||
}
|
|
||||||
#endif // QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PipPanel::handleScreenChanged(QScreen *screen) {
|
void PipPanel::handleScreenChanged(QScreen *screen) {
|
||||||
|
|
|
@ -491,7 +491,6 @@ void start() {
|
||||||
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
#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");
|
qputenv("QT_WAYLAND_SHELL_INTEGRATION", "desktop-app-xdg-shell;xdg-shell");
|
||||||
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||||
|
|
||||||
|
@ -631,7 +630,6 @@ void start() {
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||||
InvokeQueued(qApp, [] {
|
InvokeQueued(qApp, [] {
|
||||||
qunsetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION");
|
|
||||||
qunsetenv("QT_WAYLAND_SHELL_INTEGRATION");
|
qunsetenv("QT_WAYLAND_SHELL_INTEGRATION");
|
||||||
});
|
});
|
||||||
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||||
|
|
Loading…
Reference in New Issue