summaryrefslogtreecommitdiff
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 16:21:28 +0100
commit61cd5e13368bf7511fef519d7cefaa43d6094cb6 (patch)
tree6d879edbf0f4f640d06a2571bbf19fc4268dc456
parente536f28e9d7f640028461c5d02d3e50ef1102773 (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> (cherry picked from commit d8e3a08f06dcfea02c3f2f2a8578486381d77df7) Reviewed-on: https://gerrit.libreoffice.org/84619
-rw-r--r--vcl/inc/qt5/Qt5MainWindow.hxx3
-rw-r--r--vcl/qt5/Qt5Frame.cxx10
-rw-r--r--vcl/qt5/Qt5MainWindow.cxx4
3 files changed, 9 insertions, 8 deletions
diff --git a/vcl/inc/qt5/Qt5MainWindow.hxx b/vcl/inc/qt5/Qt5MainWindow.hxx
index a0836170f644..f1e91b489532 100644
--- a/vcl/inc/qt5/Qt5MainWindow.hxx
+++ b/vcl/inc/qt5/Qt5MainWindow.hxx
@@ -34,8 +34,7 @@ class Qt5MainWindow : public QMainWindow
void moveEvent(QMoveEvent*) override;
public:
- Qt5MainWindow(Qt5Frame& rFrame, QWidget* parent = Q_NULLPTR,
- Qt::WindowFlags f = Qt::WindowFlags());
+ Qt5MainWindow(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 2ca319ee515c..0a89b53c111a 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);