vcl/qt5/QtFrame.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 574a5519e23e8ed50c54fb27587afb1b5b5c13c5
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Apr 1 20:08:13 2023 +0300
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Apr 2 00:33:08 2023 +0200

    tdf#152979 qt: Re-add workaround for X11 modality change w/ hide/show
    
    Essentially add back the workaround originally added in
    
        commit e770bacc85a0eec96de77068d61b03f374b3cdec
        Date:   Sun Jun 2 21:01:33 2019 +0000
    
            Qt5 workaround modal change after show bug
    
    but then dropped again in
    
        commit 2dc6bdd1d5789ace0500cad90f5d2eb930888bb9
        Date:   Wed Jun 5 17:39:45 2019 +0000
    
            tdf#125692 SalObject always holds a SystemChildWindow
    
    , since it turns out that it is still needed for other
    use cases than the original one from tdf#125692, as the freeze
    of the basic IDE dialog dialog preview described in tdf#152979.
    
    The
    
        qt.qpa.xcb: internal error:  void 
QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window
    
    issue mentioned there is apparently also worked around in
    upstream Qt tests, s. this qtbase commit [1]:
    
        commit 3714e51436eebb64873c58dc36cf89ef8f139f09
        Author: Volker Hilsheimer <volker.hilshei...@qt.io>
        Date:   Mon Sep 20 13:44:26 2021 +0200
    
            QWidgetWindow: Stabilize test on Xcb
    
            Showing, hiding, and showing a window can result in the Xcb QPA 
plugin
            warning about
    
            qt.qpa.xcb: internal error:  void 
QXcbWindow::setNetWmStateOnUnmappedWindow()
            called on mapped window
    
            The point of the test is to verify that we get a paint event on a 
window
            that is shown again after having been hidden, not to verify that 
async
            windowing systems can handle a show/hide/show sequence. So wait for 
the
            window being exposed before we hide it.
    
            Pick-to: 6.2 5.15
            Change-Id: If91a9926613645e78e332dacff34bd57e4034b6f
            Reviewed-by: Tor Arne Vestbø <tor.arne.ves...@qt.io>
    
    Decrease the sleep from the original 250 ms to 100 ms,
    since tdf#152979 comment 14 mentions that this is enough.
    
    [1] 
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3714e51436eebb64873c58dc36cf89ef8f139f09
    
    Change-Id: I57ed520d0df85b7a3bcf47c2f9314754649482ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149912
    Tested-by: Jenkins
    Reviewed-by: Rafael Lima <rafael.palma.l...@gmail.com>

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 4bdd36e08cbd..74dfc98445af 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -619,7 +619,16 @@ void QtFrame::SetModal(bool bModal)
 
         // modality change is only effective if the window is hidden
         if (bWasVisible)
+        {
             pChild->hide();
+            if (QGuiApplication::platformName() == "xcb")
+            {
+                SAL_WARN("vcl.qt", "SetModal called after Show - apply delay");
+                // tdf#152979 give QXcbConnection some time to avoid
+                // "qt.qpa.xcb: internal error:  void 
QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window"
+                QThread::msleep(100);
+            }
+        }
 
         pChild->setWindowModality(bModal ? Qt::WindowModal : Qt::NonModal);
 

Reply via email to