summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorJan-Marek Glogowski <jan-marek.glogowski@extern.cib.de>2019-12-03 08:20:21 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2019-12-06 12:58:13 +0100
commitd8e3a08f06dcfea02c3f2f2a8578486381d77df7 (patch)
tree70b5070fc0f0dbff4f0c255b8b07f41ad3063c07 /vcl/qt5
parent72bd0df107ee47c4d54fa88b4960d32ea03e9f69 (diff)
tdf#129071 Qt5 handle windows with parents as dialogs
This is the main fix for this bug. Qt Xcb is a little picky here. It won't tell the window manager about the transient state, using WM_TRANSIENT_FOR, for all Qt::WindowTypes. The QPA internal list (see isTransient function) doesn't include the Qt::Window, which is qt5 VCL's primary used window type. This has two consequences: 1. LO dialogs show up in the plasma task manager as seperate windows. 2. LO has to handle the transient state itself, instead of relying on the window manager. This results in flickering, because LO can just push a transient window to the top again, after the parent window was activated and therefore drawn in front. So this just declares all windows with parents to be dialogs. Almost everything else should be a top-level window anyway. If not, there is SalFrameStyleFlags::DIALOG to create a parent-less dialog window. Change-Id: I89a6d46fd09e4f1d1d2904e152a26733eb266079 Reviewed-on: https://gerrit.libreoffice.org/84298 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/Qt5Frame.cxx10
-rw-r--r--vcl/qt5/Qt5MainWindow.cxx4
2 files changed, 8 insertions, 6 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 070e17a742a9..ed5f306d7ab0 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -139,18 +139,20 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
else if ((nStyle & SalFrameStyleFlags::FLOAT)
&& !(nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION))
aWinFlags |= Qt::Popup;
- else if (nStyle & SalFrameStyleFlags::DIALOG && pParent)
- aWinFlags |= Qt::Dialog;
else if (nStyle & SalFrameStyleFlags::TOOLWINDOW)
aWinFlags |= Qt::Tool;
+ // top level windows can't be transient in Qt, so make them dialogs, if they have a parent. At least
+ // the plasma shell relies on this setting to skip dialogs in the window list. And Qt Xcb will just
+ // set transient for the types Dialog, Sheet, Tool, SplashScreen, ToolTip, Drawer and Popup.
+ else if (nStyle & SalFrameStyleFlags::DIALOG || m_pParent)
+ aWinFlags |= Qt::Dialog;
else
aWinFlags |= Qt::Window;
}
if (aWinFlags == Qt::Window)
{
- QWidget* pParentWidget = m_pParent ? m_pParent->asChild() : nullptr;
- m_pTopLevel = new Qt5MainWindow(*this, pParentWidget, aWinFlags);
+ m_pTopLevel = new Qt5MainWindow(*this, aWinFlags);
m_pQWidget = new Qt5Widget(*this, aWinFlags);
m_pTopLevel->setCentralWidget(m_pQWidget);
m_pTopLevel->setFocusProxy(m_pQWidget);
diff --git a/vcl/qt5/Qt5MainWindow.cxx b/vcl/qt5/Qt5MainWindow.cxx
index a78097fb66c3..a2a0d6cea86f 100644
--- a/vcl/qt5/Qt5MainWindow.cxx
+++ b/vcl/qt5/Qt5MainWindow.cxx
@@ -15,8 +15,8 @@
#include <QtGui/QAccessible>
#include <QtGui/QCloseEvent>
-Qt5MainWindow::Qt5MainWindow(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f)
- : QMainWindow(parent, f)
+Qt5MainWindow::Qt5MainWindow(Qt5Frame& rFrame, Qt::WindowFlags f)
+ : QMainWindow(nullptr, f)
, m_rFrame(rFrame)
{
QAccessible::installFactory(Qt5AccessibleWidget::customFactory);