[Libreoffice-commits] core.git: Branch 'libreoffice-7-2-2' - vcl/inc vcl/qt5

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 26 17:47:47 UTC 2021


 vcl/inc/qt5/Qt5Frame.hxx  |    7 -------
 vcl/inc/qt5/Qt5Widget.hxx |    1 -
 vcl/qt5/Qt5Frame.cxx      |   12 +++++-------
 vcl/qt5/Qt5Widget.cxx     |   20 +-------------------
 4 files changed, 6 insertions(+), 34 deletions(-)

New commits:
commit dac5a26ae1108d9ad29e09a800601247fe8c50d6
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Sep 20 13:56:00 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Sun Sep 26 19:47:11 2021 +0200

    tdf#144585 Qt5 restore old VCL popup handling
    
    So while it works with X11, the Wayland situation seems much
    worse. Eventually we want to use Qt::Popup as a window type,
    because that implies special handling for Wayland, but the
    additional private Qt mechanisms this implies conflict with VCL
    handling, especially input + focus handling with ComboBox. I'll
    re-check (again) how Qt itself implements this and maybe that
    solution is adaptable to VCL.
    
    This re-introduces the problem, that "DropDown/PopUp stays open
    and in FG when changing app on Linux desktop (keyboard, ALT+TAB)",
    original reported as part of tdf#143114, which is some kind of
    kf5 catchall bug report.
    
    Just revert for 7-2. Hope we find a better solution on master,
    which can be backported later.
    
    This revert includes:
    
    - "tdf#144037 Qt5 just close popup with mouse outside"
      commit 7c1f4284562e905372b5c14b6017f1eb438f54b5
    - "tdf#143580 Qt5 don't use Qt::Popup for FLOAT wins"
      commit ea2f19827db330a21c7962bdd13b1b838821bd4c
    - "Qt5 fix Qt::Popup window handling"
      commit 7e6fee830116823b9cd8e46d6962df4ea2bc1ea6
    
    Change-Id: Ibf56187e00232f6c75cdbbc82ce915f80214a136
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122356
    Tested-by: Michael Weghorn <m.weghorn at posteo.de>
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    (cherry picked from commit a928bab9fb68ff8fe45aca212b3c794799db31f6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122449
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas at libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Tested-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 01b93ad3b825..ed82c2a7a8fb 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -210,7 +210,6 @@ public:
     inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
 
     void setInputLanguage(LanguageType);
-    inline bool isPopup() const;
 };
 
 inline bool Qt5Frame::CallCallback(SalEvent nEvent, const void* pEvent) const
@@ -219,10 +218,4 @@ inline bool Qt5Frame::CallCallback(SalEvent nEvent, const void* pEvent) const
     return SalFrame::CallCallback(nEvent, pEvent);
 }
 
-inline bool Qt5Frame::isPopup() const
-{
-    return ((m_nStyle & SalFrameStyleFlags::FLOAT)
-            && !(m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION));
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 60db1a306efd..7bf7ead6ae9a 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -75,7 +75,6 @@ class Qt5Widget : public QWidget
 
     void inputMethodEvent(QInputMethodEvent*) override;
     QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
-    static void closePopup();
 
 public:
     Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index a4c78d1b71a7..322f293828cd 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -144,13 +144,11 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
         else if ((nStyle & SalFrameStyleFlags::FLOAT)
                  && (nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION))
             aWinFlags |= Qt::Tool | Qt::FramelessWindowHint;
-        else if (nStyle & SalFrameStyleFlags::TOOLTIP)
+        else if (nStyle & (SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::TOOLTIP))
             aWinFlags |= Qt::ToolTip;
-        // Can't use Qt::Popup, because it grabs the input focus and generates
-        // a focus-out event, reaking the compbo box. This used to map to
-        // Qt::ToolTip, which doesn't feel that correct...
-        else if (isPopup())
-            aWinFlags = Qt::Widget | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint;
+        else if ((nStyle & SalFrameStyleFlags::FLOAT)
+                 && !(nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION))
+            aWinFlags |= Qt::Popup;
         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
@@ -428,7 +426,7 @@ void Qt5Frame::Show(bool bVisible, bool bNoActivate)
     pSalInst->RunInMainThread([this, bVisible, bNoActivate]() {
         asChild()->setVisible(bVisible);
         asChild()->raise();
-        if (!bNoActivate && !isPopup())
+        if (!bNoActivate)
         {
             asChild()->activateWindow();
             asChild()->setFocus();
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index ca23138b5739..6cb548c0d028 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -46,7 +46,6 @@
 #include <cairo.h>
 #include <vcl/commandevent.hxx>
 #include <vcl/event.hxx>
-#include <vcl/toolkit/floatwin.hxx>
 #include <window.h>
 #include <tools/diagnose_ex.h>
 
@@ -178,13 +177,7 @@ void Qt5Widget::handleMouseButtonEvent(const Qt5Frame& rFrame, const QMouseEvent
     rFrame.CallCallback(nEventType, &aEvent);
 }
 
-void Qt5Widget::mousePressEvent(QMouseEvent* pEvent)
-{
-    handleMousePressEvent(m_rFrame, pEvent);
-    if (m_rFrame.isPopup()
-        && !geometry().translated(geometry().topLeft() * -1).contains(pEvent->pos()))
-        closePopup();
-}
+void Qt5Widget::mousePressEvent(QMouseEvent* pEvent) { handleMousePressEvent(m_rFrame, pEvent); }
 
 void Qt5Widget::mouseReleaseEvent(QMouseEvent* pEvent)
 {
@@ -598,22 +591,11 @@ void Qt5Widget::keyReleaseEvent(QKeyEvent* pEvent)
 
 void Qt5Widget::focusInEvent(QFocusEvent*) { m_rFrame.CallCallback(SalEvent::GetFocus, nullptr); }
 
-void Qt5Widget::closePopup()
-{
-    VclPtr<FloatingWindow> pFirstFloat = ImplGetSVData()->mpWinData->mpFirstFloat;
-    if (pFirstFloat && !(pFirstFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoAppFocusClose))
-    {
-        SolarMutexGuard aGuard;
-        pFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
-    }
-}
-
 void Qt5Widget::focusOutEvent(QFocusEvent*)
 {
     m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE;
     endExtTextInput();
     m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr);
-    closePopup();
 }
 
 Qt5Widget::Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)


More information about the Libreoffice-commits mailing list