[Xfce4-commits] [xfce/libxfce4ui] 04/08: Replace deprecated device functions (Bug #15781)
noreply at xfce.org
noreply at xfce.org
Sun Oct 13 20:06:16 CEST 2019
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/libxfce4ui.
commit e8756631cae39dd7c3830b44db7af561867550ae
Author: Andre Miranda <andreldm at xfce.org>
Date: Sun Aug 4 13:45:29 2019 -0300
Replace deprecated device functions (Bug #15781)
---
libxfce4kbd-private/xfce-shortcut-dialog.c | 34 ++++++------------------------
libxfce4ui/xfce-gdk-extensions.c | 9 +-------
2 files changed, 8 insertions(+), 35 deletions(-)
diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c
index 82c3d5c..b01354e 100644
--- a/libxfce4kbd-private/xfce-shortcut-dialog.c
+++ b/libxfce4kbd-private/xfce-shortcut-dialog.c
@@ -340,9 +340,7 @@ xfce_shortcut_dialog_run (XfceShortcutDialog *dialog,
{
#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
- GdkDevice *device;
- GdkDeviceManager *device_manager;
- GList *devices, *li;
+ GdkSeat *seat;
gboolean succeed = FALSE;
#endif
gint response = GTK_RESPONSE_CANCEL;
@@ -354,22 +352,13 @@ xfce_shortcut_dialog_run (XfceShortcutDialog *dialog,
#if GTK_CHECK_VERSION (3, 0, 0)
display = gtk_widget_get_display (GTK_WIDGET (dialog));
- device_manager = gdk_display_get_device_manager (display);
- devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+ seat = gdk_display_get_default_seat (display);
- for (li = devices; li != NULL; li =li->next)
+ 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)
{
- device = li->data;
- if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
- continue;
-
- if (gdk_device_grab (device, gdk_screen_get_root_window (gdk_display_get_default_screen (display)),
- GDK_OWNERSHIP_WINDOW, TRUE,
- GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- NULL, GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
- {
- succeed = TRUE;
- }
+ succeed = TRUE;
}
/* Take control on the keyboard */
@@ -391,12 +380,7 @@ xfce_shortcut_dialog_run (XfceShortcutDialog *dialog,
#if GTK_CHECK_VERSION (3, 0, 0)
/* Release keyboard */
- for (li = devices; li != NULL; li =li->next)
- {
- device = li->data;
- if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
- gdk_device_ungrab (device, GDK_CURRENT_TIME);
- }
+ gdk_seat_ungrab (seat);
#else
/* Release keyboard */
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
@@ -407,10 +391,6 @@ xfce_shortcut_dialog_run (XfceShortcutDialog *dialog,
g_warning (_("Could not grab the keyboard."));
}
-#if GTK_CHECK_VERSION (3, 0, 0)
- g_list_free (devices);
-#endif
-
/* Return the response ID */
return response;
}
diff --git a/libxfce4ui/xfce-gdk-extensions.c b/libxfce4ui/xfce-gdk-extensions.c
index cd4e451..ccf067f 100644
--- a/libxfce4ui/xfce-gdk-extensions.c
+++ b/libxfce4ui/xfce-gdk-extensions.c
@@ -63,19 +63,12 @@ xfce_gdk_screen_get_active (gint *monitor_return)
gint rootx, rooty;
GdkScreen *screen;
-#if 0 /* GTK_CHECK_VERSION (3, 20, 0) */
+#if GTK_CHECK_VERSION (3, 22, 0)
GdkSeat *seat;
display = gdk_display_get_default ();
seat = gdk_display_get_default_seat (display);
gdk_device_get_position (gdk_seat_get_pointer (seat), &screen, &rootx, &rooty);
-#elif GTK_CHECK_VERSION (3, 0, 0)
- GdkDeviceManager *manager;
-
- display = gdk_display_get_default ();
- manager = gdk_display_get_device_manager (display);
- gdk_device_get_position (gdk_device_manager_get_client_pointer (manager),
- &screen, &rootx, &rooty);
#else
display = gdk_display_get_default ();
gdk_display_get_pointer (display, &screen, &rootx, &rooty, NULL);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list