From aeb0d466e07ab50cb2ac9d8cc7a06a5fda253793 Mon Sep 17 00:00:00 2001 From: Olivier Duchateau Date: Sun, 5 Apr 2020 14:33:54 +0200 Subject: [PATCH] Replace deprecated 'gdk_keyboard_ungrab' function --- libxfce4kbd-private/xfce-shortcut-dialog.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c index f3dad48..427855a 100644 --- a/libxfce4kbd-private/xfce-shortcut-dialog.c +++ b/libxfce4kbd-private/xfce-shortcut-dialog.c @@ -23,6 +23,7 @@ #endif #include +#include #include #include @@ -403,7 +404,13 @@ static gboolean xfce_shortcut_dialog_key_released (XfceShortcutDialog *dialog, GdkEventKey *event) { - gboolean shortcut_accepted = FALSE; + gboolean shortcut_accepted = FALSE; + GdkWindow *window = event->window; + GdkDisplay *display; + GdkSeat *seat; + + display = gdk_window_get_display (window); + seat = gdk_display_get_default_seat (display); /* Let 'validate-shortcut' listeners decide whether this shortcut is ok or not */ g_signal_emit_by_name (dialog, "validate-shortcut", dialog->shortcut, &shortcut_accepted); @@ -412,10 +419,15 @@ xfce_shortcut_dialog_key_released (XfceShortcutDialog *dialog, if (G_LIKELY (shortcut_accepted)) { /* Release keyboard */ - gdk_keyboard_ungrab (GDK_CURRENT_TIME); + if (gdk_seat_grab (seat, window, + GDK_SEAT_CAPABILITY_KEYBOARD, + TRUE, NULL, NULL, NULL, NULL)) + { + gdk_seat_ungrab (seat); - /* Exit dialog with positive response */ - gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + /* Exit dialog with positive response */ + gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + } } else { -- 2.25.1