summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx31
1 files changed, 31 insertions, 0 deletions
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();
}