summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3/gtk3gtkinst.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/gtk3/gtk3gtkinst.cxx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5af961ed5aeb..c45a66e9edd4 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2546,6 +2546,39 @@ public:
return pTopLevel && gtk_window_is_active(pTopLevel) && has_focus();
}
+ // is the focus in a child of this widget, where a transient popup attached
+ // to a widget is considered a child of that widget
+ virtual bool has_child_focus() const override
+ {
+ bool bRet = false;
+
+ GList* pList = gtk_window_list_toplevels();
+
+ for (GList* pEntry = pList; pEntry; pEntry = pEntry->next)
+ {
+ if (!gtk_window_has_toplevel_focus(GTK_WINDOW(pEntry->data)))
+ continue;
+ GtkWidget* pFocus = gtk_window_get_focus(GTK_WINDOW(pEntry->data));
+ if (pFocus && gtk_widget_is_ancestor(pFocus, m_pWidget))
+ {
+ bRet = true;
+ break;
+ }
+ GtkWidget* pAttachedTo = gtk_window_get_attached_to(GTK_WINDOW(pEntry->data));
+ if (!pAttachedTo)
+ continue;
+ if (pAttachedTo == m_pWidget || gtk_widget_is_ancestor(pAttachedTo, m_pWidget))
+ {
+ bRet = true;
+ break;
+ }
+ }
+
+ g_list_free(pList);
+
+ return bRet;
+ }
+
virtual void set_has_default(bool has_default) override
{
g_object_set(G_OBJECT(m_pWidget), "has-default", has_default, nullptr);