vcl/inc/qt5/QtInstancePopover.hxx     |    2 ++
 vcl/qt5/QtInstancePopover.cxx         |   18 ++++++++++++++++++
 vcl/unx/gtk3/fpicker/SalGtkPicker.cxx |    2 --
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 3e9550b86d324887d4979f00cca78e7db3b99855
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Sep 10 14:38:52 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Sep 10 20:48:00 2025 +0200

    gtk: Drop unused a11y includes
    
    Change-Id: I378dd89ed5e4255812d28ffa64da64c732742650
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190764
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx
index 5bbf94d7b74f..5fc439952722 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx
@@ -20,8 +20,6 @@
 #include <com/sun/star/frame/TerminationVetoException.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <osl/diagnose.h>
 #include <sal/log.hxx>
 #include <utility>
commit 71564adc6ba5b097733274d590c81ac87a40ec6b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Sep 10 18:14:05 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Sep 10 20:47:47 2025 +0200

    tdf#160838 tdf#130857 qt weld: Signal on popup close
    
    Call weld::Popover::signal_closed to notify
    when the popup is closed.
    
    To do so, handle the QEvent::Close event
    in QtInstancePopover and queue the signalling
    of the closing for when control returns to
    the main loop.
    
    At the point in time that QtInstancePopover::eventFilter
    gets called with the event, the popup hasn't
    actually been closed yet. This only happens
    when the event gets processed by the widget
    later, so calling Popover::signal_closed()
    right away would be too early.
    
    Sending the signal is e.g. needed to allow opening the
    comment popup in Impress multiple times
    in a WIP branch where support for native Qt widgets
    for that popup is declared with
    SAL_VCL_QT_USE_WELDED_WIDGETS=1.
    
    Otherwise, AnnotationPopup::closePopup would
    not get called, `AnnotationPopup::mpAnnotationWindow`
    wouldn't be reset and therefore not newly set
    and shown when clicking on a comment in Impress again.
    
    Relevant part of the backtrace when the signal is sent
    as it should:
    
        1   sd::AnnotationPopup::closePopup
        2   sd::AnnotationPopup::PopupModeEndHdl
        3   sd::AnnotationPopup::LinkStubPopupModeEndHdl
        4   Link<weld::Popover&, void>::Call
        5   weld::Popover::signal_closed
        [...]
    
    (More is needed before support for that popup
    can actually be declared in
    QtInstanceBuilder::IsUIFileSupported; this is
    just one step.)
    
    Change-Id: I472c101f7871a5189b985a5d89e642287450ec5d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190775
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtInstancePopover.hxx 
b/vcl/inc/qt5/QtInstancePopover.hxx
index db928aa4a600..8bcf1dfc865b 100644
--- a/vcl/inc/qt5/QtInstancePopover.hxx
+++ b/vcl/inc/qt5/QtInstancePopover.hxx
@@ -23,6 +23,8 @@ public:
     virtual void popdown() override;
 
     virtual void resize_to_request() override;
+
+    virtual bool eventFilter(QObject* pObject, QEvent* pEvent) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qt5/QtInstancePopover.cxx b/vcl/qt5/QtInstancePopover.cxx
index df88afcf1741..68638bdf8237 100644
--- a/vcl/qt5/QtInstancePopover.cxx
+++ b/vcl/qt5/QtInstancePopover.cxx
@@ -44,4 +44,22 @@ void QtInstancePopover::popdown()
 
 void QtInstancePopover::resize_to_request() { assert(false && "Not implemented 
yet"); }
 
+bool QtInstancePopover::eventFilter(QObject* pObject, QEvent* pEvent)
+{
+    if (pObject == getQWidget() && pEvent->type() == QEvent::Close)
+    {
+        // signal that the popup was closed when control returns to the
+        // main loop (at which point the event to close the popup has
+        // actually been processed)
+        QMetaObject::invokeMethod(this,
+                                  [this] {
+                                      SolarMutexGuard g;
+                                      signal_closed();
+                                  },
+                                  Qt::QueuedConnection);
+    }
+
+    return QtInstanceWidget::eventFilter(pObject, pEvent);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to