diff options
author | Andre Miranda <andreldm@xfce.org> | 2019-11-03 14:48:34 -0300 |
---|---|---|
committer | Andre Miranda <andreldm@xfce.org> | 2019-11-03 14:48:34 -0300 |
commit | c4023afce25b626f5e5af7df306ac7ac421f8b19 (patch) | |
tree | 4b4e73a1e06984a5987fb75688927aed66388397 | |
parent | dfdaf372461954434e858bc9695b36899e562dbe (diff) | |
download | libxfce4ui-xfce-4.14.tar.gz |
Fix Window has not been made visible when grabbing keyboard (Bug #16054)xfce-4.14
This is a strange new behavior of gtk3 that seems to require showing
the root window. If this causes anymore trouble, stick to the deprecated
function.
-rw-r--r-- | libxfce4kbd-private/xfce-shortcut-dialog.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c index c3e9630..3c852e8 100644 --- a/libxfce4kbd-private/xfce-shortcut-dialog.c +++ b/libxfce4kbd-private/xfce-shortcut-dialog.c @@ -44,6 +44,11 @@ static gboolean xfce_shortcut_dialog_key_pressed (XfceShortcutDialog * static gboolean xfce_shortcut_dialog_key_released (XfceShortcutDialog *dialog, GdkEventKey *event); +#if GTK_CHECK_VERSION (3, 0, 0) +static void xfce_shortcut_dialog_prepare_grab (GdkSeat *seat, + GdkWindow *window, + gpointer user_data); +#endif struct _XfceShortcutDialogClass @@ -333,7 +338,6 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog, } - gint xfce_shortcut_dialog_run (XfceShortcutDialog *dialog, GtkWidget *parent) @@ -341,7 +345,6 @@ xfce_shortcut_dialog_run (XfceShortcutDialog *dialog, #if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; GdkSeat *seat; - gboolean succeed = FALSE; #endif gint response = GTK_RESPONSE_CANCEL; @@ -354,15 +357,11 @@ xfce_shortcut_dialog_run (XfceShortcutDialog *dialog, display = gtk_widget_get_display (GTK_WIDGET (dialog)); seat = gdk_display_get_default_seat (display); + /* Take control on the keyboard */ if (gdk_seat_grab (seat, gdk_screen_get_root_window (gdk_display_get_default_screen (display)), - GDK_SEAT_CAPABILITY_KEYBOARD, TRUE, NULL, NULL, NULL, NULL) == GDK_GRAB_SUCCESS) - { - succeed = TRUE; - } - - /* Take control on the keyboard */ - if (succeed) + GDK_SEAT_CAPABILITY_ALL, TRUE, NULL, NULL, + xfce_shortcut_dialog_prepare_grab, NULL) == GDK_GRAB_SUCCESS) #else /* Take control on the keyboard */ if (G_LIKELY (gdk_keyboard_grab (gtk_widget_get_root_window (GTK_WIDGET (dialog)), TRUE, GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)) @@ -515,3 +514,15 @@ xfce_shortcut_dialog_get_action_name (XfceShortcutDialog *dialog) g_return_val_if_fail (XFCE_IS_SHORTCUT_DIALOG (dialog), NULL); return dialog->action_name; } + + + +#if GTK_CHECK_VERSION (3, 0, 0) +static void +xfce_shortcut_dialog_prepare_grab (GdkSeat *seat, + GdkWindow *window, + gpointer user_data) +{ + gdk_window_show_unraised (window); +} +#endif |