[gtk+] tests: Avoid deprecated API usage in testsocket
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tests: Avoid deprecated API usage in testsocket
- Date: Thu, 28 Jan 2016 11:51:19 +0000 (UTC)
commit a74db1de77f62ee36f2f9be1670eb26b621c843a
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jan 28 12:46:07 2016 +0100
tests: Avoid deprecated API usage in testsocket
We can use seat grabs here.
tests/testsocket.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/tests/testsocket.c b/tests/testsocket.c
index c1b59c1..b250f10 100644
--- a/tests/testsocket.c
+++ b/tests/testsocket.c
@@ -281,29 +281,23 @@ grab_window_toggled (GtkToggleButton *button,
GtkWidget *widget)
{
GdkDevice *device = gtk_get_current_event_device ();
-
- if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
- device = gdk_device_get_associated_device (device);
+ GdkSeat *seat = gdk_device_get_seat (device);
if (gtk_toggle_button_get_active (button))
{
int status;
- status = gdk_device_grab (device,
- gtk_widget_get_window (widget),
- GDK_OWNERSHIP_NONE,
- FALSE,
- GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- NULL,
- GDK_CURRENT_TIME);
+ status = gdk_seat_grab (seat, gtk_widget_get_window (widget),
+ GDK_SEAT_CAPABILITY_KEYBOARD,
+ FALSE, NULL, NULL, NULL, NULL);
if (status != GDK_GRAB_SUCCESS)
g_warning ("Could not grab keyboard! (%s)", grab_string (status));
- }
- else
+ }
+ else
{
- gdk_device_ungrab (device, GDK_CURRENT_TIME);
+ gdk_seat_ungrab (seat);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]