Keep toplevel windows in the top left corner of the screen
This commit is contained in:
parent
39a0b30ef1
commit
58b1ec4bdf
@ -0,0 +1,75 @@
|
|||||||
|
From de46b3c6d1bef4b8f64c7db7069c8fd33ef23ed9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Redondo <qt@david-redondo.de>
|
||||||
|
Date: Wed, 8 Jun 2022 11:25:59 +0200
|
||||||
|
Subject: [PATCH] Keep toplevel windows in the top left corner of the screen
|
||||||
|
|
||||||
|
Cherry-picked from commit a46795a2. Fixes https://bugs.kde.org/show_bug.cgi?id=436016
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
We can't know the actual position of a window on the screen. This causes
|
||||||
|
an issue when Widgets try to position a popup/menu absolutely and keep
|
||||||
|
it on the screen when the screen geometry doesn't include (0,0).
|
||||||
|
Instead report their positions always as the top left corner of
|
||||||
|
the screen that they are on.
|
||||||
|
This new behavior can be disabled for qt-shell or via an environment
|
||||||
|
variable by users that rely on the old behavior.
|
||||||
|
|
||||||
|
Fixes: QTBUG-85297
|
||||||
|
Change-Id: Iacb91cb03a0df87af950115760d2f41124ac06a3
|
||||||
|
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
||||||
|
Reviewed-by: David Edmundson <davidedmundson@kde.org>
|
||||||
|
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
---
|
||||||
|
src/client/qwaylandintegration.cpp | 4 ++++
|
||||||
|
src/client/qwaylandwindow.cpp | 14 +++++++++++++-
|
||||||
|
src/client/qwaylandwindow_p.h | 3 +++
|
||||||
|
3 files changed, 20 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
|
||||||
|
index 5161604..d57e9ed 100644
|
||||||
|
--- a/src/client/qwaylandwindow.cpp
|
||||||
|
+++ b/src/client/qwaylandwindow.cpp
|
||||||
|
@@ -364,8 +364,13 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-void QWaylandWindow::setGeometry(const QRect &rect)
|
||||||
|
+void QWaylandWindow::setGeometry(const QRect &r)
|
||||||
|
{
|
||||||
|
+ auto rect = r;
|
||||||
|
+ if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup
|
||||||
|
+ && window()->type() != Qt::ToolTip) {
|
||||||
|
+ rect.moveTo(screen()->geometry().topLeft());
|
||||||
|
+ }
|
||||||
|
setGeometry_helper(rect);
|
||||||
|
|
||||||
|
if (window()->isVisible() && rect.isValid()) {
|
||||||
|
@@ -1242,6 +1247,13 @@ void QWaylandWindow::handleScreensChanged()
|
||||||
|
|
||||||
|
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen());
|
||||||
|
mLastReportedScreen = newScreen;
|
||||||
|
+ if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup
|
||||||
|
+ && window()->type() != Qt::ToolTip
|
||||||
|
+ && geometry().topLeft() != newScreen->geometry().topLeft()) {
|
||||||
|
+ auto geometry = this->geometry();
|
||||||
|
+ geometry.moveTo(newScreen->geometry().topLeft());
|
||||||
|
+ setGeometry(geometry);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
int scale = newScreen->isPlaceholder() ? 1 : static_cast<QWaylandScreen *>(newScreen)->scale();
|
||||||
|
if (scale != mScale) {
|
||||||
|
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
|
||||||
|
index 28f780b..53344fc 100644
|
||||||
|
--- a/src/client/qwaylandwindow_p.h
|
||||||
|
+++ b/src/client/qwaylandwindow_p.h
|
||||||
|
@@ -110,6 +110,9 @@ public:
|
||||||
|
QWaylandWindow(QWindow *window, QWaylandDisplay *display);
|
||||||
|
~QWaylandWindow() override;
|
||||||
|
|
||||||
|
+ // Keep Toplevels position on the top left corner of their screen
|
||||||
|
+ static inline bool fixedToplevelPositions = true;
|
||||||
|
+
|
||||||
|
virtual WindowType windowType() const = 0;
|
||||||
|
virtual void ensureSize();
|
||||||
|
WId winId() const override;
|
||||||
|
--
|
||||||
|
GitLab
|
@ -11,7 +11,7 @@
|
|||||||
Summary: Qt6 - Wayland platform support and QtCompositor module
|
Summary: Qt6 - Wayland platform support and QtCompositor module
|
||||||
Name: qt6-%{qt_module}
|
Name: qt6-%{qt_module}
|
||||||
Version: 6.3.1
|
Version: 6.3.1
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
|
|
||||||
License: LGPLv3
|
License: LGPLv3
|
||||||
Url: http://www.qt.io
|
Url: http://www.qt.io
|
||||||
@ -25,6 +25,7 @@ Source0: https://download.qt.io/official_releases/qt/%{majmin}/%{version}/submod
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Upstream patches
|
# Upstream patches
|
||||||
|
Patch100: 0100-Keep-toplevel-windows-in-the-top-left-corner-of-the-screen.patch
|
||||||
|
|
||||||
# Upstreamable patches
|
# Upstreamable patches
|
||||||
|
|
||||||
@ -173,6 +174,9 @@ popd
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jul 26 2022 Jan Grulich <jgrulich@redhat.com> - 6.3.1-3
|
||||||
|
- Keep toplevel windows in the top left corner of the screen
|
||||||
|
|
||||||
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.3.1-2
|
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.3.1-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user