vcl/unx/gtk3/gtk3gtkinst.cxx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
New commits: commit c7cfd3323cf80d5953f5c3808c1afd6fec0c674b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Apr 5 20:25:42 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Apr 5 22:20:22 2021 +0200 tdf#141499 trigger container_focus_changed for toplevel window focus events retaining the single callback of commit 9ffd28c32a301141a26e41ddd0cf485a562c83bb Date: Fri Mar 5 16:13:19 2021 +0000 use container_focus_changed instead of toplevel_focus_changed for focus events affecting the container where for gen its all the same thing, but restore the gtk code for toplevel window gaining/losing focus which set-focus-child doesn't fire on Change-Id: Ia254a447283d0b3dd1a76072820d85ff379865f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113616 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 95377fbe6594..377ac47461de 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -4075,6 +4075,7 @@ class GtkInstanceWindow : public GtkInstanceContainer, public virtual weld::Wind private: GtkWindow* m_pWindow; rtl::Reference<SalGtkXWindow> m_xWindow; //uno api + gulong m_nToplevelFocusChangedSignalId; static gboolean help_pressed(GtkAccelGroup*, GObject*, guint, GdkModifierType, gpointer widget) { @@ -4083,6 +4084,12 @@ private: return true; } + static void signalToplevelFocusChanged(GtkWindow*, GParamSpec*, gpointer widget) + { + GtkInstanceWindow* pThis = static_cast<GtkInstanceWindow*>(widget); + pThis->signal_container_focus_changed(); + } + bool isPositioningAllowed() const { bool bPositioningAllowed = true; @@ -4100,6 +4107,7 @@ public: GtkInstanceWindow(GtkWindow* pWindow, GtkInstanceBuilder* pBuilder, bool bTakeOwnership) : GtkInstanceContainer(GTK_CONTAINER(pWindow), pBuilder, bTakeOwnership) , m_pWindow(pWindow) + , m_nToplevelFocusChangedSignalId(0) { const bool bIsFrameWeld = pBuilder == nullptr; if (!bIsFrameWeld) @@ -4259,6 +4267,27 @@ public: return aData.ToStr(); } + virtual void connect_container_focus_changed(const Link<Container&, void>& rLink) override + { + if (!m_nToplevelFocusChangedSignalId) + m_nToplevelFocusChangedSignalId = g_signal_connect(m_pWindow, "notify::has-toplevel-focus", G_CALLBACK(signalToplevelFocusChanged), this); + GtkInstanceContainer::connect_container_focus_changed(rLink); + } + + virtual void disable_notify_events() override + { + if (m_nToplevelFocusChangedSignalId) + g_signal_handler_block(m_pWidget, m_nToplevelFocusChangedSignalId); + GtkInstanceContainer::disable_notify_events(); + } + + virtual void enable_notify_events() override + { + GtkInstanceContainer::enable_notify_events(); + if (m_nToplevelFocusChangedSignalId) + g_signal_handler_unblock(m_pWidget, m_nToplevelFocusChangedSignalId); + } + virtual VclPtr<VirtualDevice> screenshot() override { // detect if we have to manually setup its size @@ -4312,6 +4341,8 @@ public: virtual ~GtkInstanceWindow() override { + if (m_nToplevelFocusChangedSignalId) + g_signal_handler_disconnect(m_pWindow, m_nToplevelFocusChangedSignalId); if (m_xWindow.is()) m_xWindow->clear(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits