Files
libreoffice/vcl/qt5/Qt5MainWindow.cxx
Jan-Marek Glogowski d8e3a08f06 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>
2019-12-06 12:58:13 +01:00

45 lines
1.3 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#include <Qt5MainWindow.hxx>
#include <Qt5MainWindow.moc>
#include <Qt5AccessibleWidget.hxx>
#include <QtGui/QAccessible>
#include <QtGui/QCloseEvent>
Qt5MainWindow::Qt5MainWindow(Qt5Frame& rFrame, Qt::WindowFlags f)
: QMainWindow(nullptr, f)
, m_rFrame(rFrame)
{
QAccessible::installFactory(Qt5AccessibleWidget::customFactory);
}
void Qt5MainWindow::closeEvent(QCloseEvent* pEvent)
{
bool bRet = false;
bRet = m_rFrame.CallCallback(SalEvent::Close, nullptr);
if (bRet)
pEvent->accept();
// SalEvent::Close returning false may mean that user has vetoed
// closing the frame ("you have unsaved changes" dialog for example)
// We shouldn't process the event in such case
else
pEvent->ignore();
}
void Qt5MainWindow::moveEvent(QMoveEvent* pEvent)
{
m_rFrame.maGeometry.nX = pEvent->pos().x();
m_rFrame.maGeometry.nY = pEvent->pos().y();
m_rFrame.CallCallback(SalEvent::Move, nullptr);
}