diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2021-11-10 16:19:26 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2021-11-11 08:27:28 +0100 |
commit | f029fb6262b9a001e6cbfd60565b01a7b99ea627 (patch) | |
tree | 2c696619634cc56a4c4e350198894aa1e25ac563 | |
parent | 84991e145c9e735240114e6ec4b94993060fb6c4 (diff) |
qt (>=5.14): Don't create native window for QWidget in QtFrame::screen
For Qt >= 5.14, directly use 'QWidget::screen' (added in Qt 5.14)
to retrieve the screen that the widget is on, rather than first
retrieving a window handle, which forces a platform-native
window to be created.
Due to QTBUG-75766 [1], forcing the creation of
native windows also leads to mouseMoveEvents
not being reliably emitted by Qt, s.
commit 0e3c3b842e14b9646d3697cf1266be21359e0f13
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat May 11 21:31:33 2019 +0200
tdf#122293 qt5: Use "alien widgets" by default on Wayland
for more details.
The behaviour described in tdf#122293 started showing
up again after
commit b00a68a8e19370e106cd76258a3c1825f43613ee
Date: Sun Oct 31 02:33:46 2021 +0200
tdf#145363 Qt reparent modal dialogs on show
but that just seems to have been a side-effect of
'QWidget::screen' now being called in different ways
than previously.
[1] https://bugreports.qt.io/browse/QTBUG-75766
Change-Id: Ic11923cef5e704c09494f96b19157372a869ae40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124997
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r-- | vcl/qt5/QtFrame.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 591e084edf38..db91e48a256c 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -363,8 +363,15 @@ QWindow* QtFrame::windowHandle() const QScreen* QtFrame::screen() const { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + return asChild()->screen(); +#else + // QWidget::screen only available from Qt 5.14 on, call windowHandle(), + // with the indirect result that mouse move events on Wayland will not be + // emitted reliably, s. QTBUG-75766 QWindow* const pWindow = windowHandle(); return pWindow ? pWindow->screen() : nullptr; +#endif } bool QtFrame::isMinimized() const { return asChild()->isMinimized(); } |