diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-02-26 21:34:57 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-26 21:38:25 +0000 |
commit | 1724081f6363fb2b97523a2c5edb1424d7959f8b (patch) | |
tree | 45f53ec7d2994989dd7a9b0121749cc0d5f70058 | |
parent | 3ae6c7fcbe14f7a425fa1db2cb388b12848be65b (diff) |
gtk3+wayland: gnome#762756 hack around keyboard focus
Change-Id: I6be61592a16660d62be583e082ffcf5b1907770f
-rw-r--r-- | vcl/unx/gtk/gtksalmenu.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx index 0220aa44b2cc..f3ec5015f615 100644 --- a/vcl/unx/gtk/gtksalmenu.cxx +++ b/vcl/unx/gtk/gtksalmenu.cxx @@ -559,6 +559,22 @@ void GtkSalMenu::ShowCloseButton(bool bShow) #endif } +#if GTK_CHECK_VERSION(3,0,0) +//hack-around https://bugzilla.gnome.org/show_bug.cgi?id=762756 +static void ReturnFocus(GtkMenuShell *, gpointer pWidget) +{ + GtkWidget* pTopLevel = static_cast<GtkWidget*>(pWidget); + GdkWindow *window = gtk_widget_get_window(pTopLevel); + GdkEvent *fevent = gdk_event_new(GDK_FOCUS_CHANGE); + + fevent->focus_change.type = GDK_FOCUS_CHANGE; + fevent->focus_change.window = GDK_WINDOW(g_object_ref(window)); + fevent->focus_change.in = TRUE; + gtk_widget_send_focus_change(pTopLevel, fevent); + gdk_event_free(fevent); +} +#endif + void GtkSalMenu::CreateMenuBarWidget() { #if GTK_CHECK_VERSION(3,0,0) @@ -573,6 +589,7 @@ void GtkSalMenu::CreateMenuBarWidget() gtk_widget_insert_action_group(pMenuBarWidget, "win", mpActionGroup); gtk_widget_set_hexpand(GTK_WIDGET(pMenuBarWidget), true); gtk_grid_attach(GTK_GRID(mpMenuBarWidget), pMenuBarWidget, 0, 0, 1, 1); + g_signal_connect(G_OBJECT(pMenuBarWidget), "deactivate", G_CALLBACK(ReturnFocus), mpFrame->getWindow()); gtk_widget_show_all(mpMenuBarWidget); #endif |