tests: Avoid deprecated API usage in testsocket
We can use seat grabs here.
This commit is contained in:
parent
fef661ae84
commit
a74db1de77
@ -281,21 +281,15 @@ grab_window_toggled (GtkToggleButton *button,
|
|||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GdkDevice *device = gtk_get_current_event_device ();
|
GdkDevice *device = gtk_get_current_event_device ();
|
||||||
|
GdkSeat *seat = gdk_device_get_seat (device);
|
||||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
|
||||||
device = gdk_device_get_associated_device (device);
|
|
||||||
|
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = gdk_device_grab (device,
|
status = gdk_seat_grab (seat, gtk_widget_get_window (widget),
|
||||||
gtk_widget_get_window (widget),
|
GDK_SEAT_CAPABILITY_KEYBOARD,
|
||||||
GDK_OWNERSHIP_NONE,
|
FALSE, NULL, NULL, NULL, NULL);
|
||||||
FALSE,
|
|
||||||
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
|
|
||||||
NULL,
|
|
||||||
GDK_CURRENT_TIME);
|
|
||||||
|
|
||||||
if (status != GDK_GRAB_SUCCESS)
|
if (status != GDK_GRAB_SUCCESS)
|
||||||
g_warning ("Could not grab keyboard! (%s)", grab_string (status));
|
g_warning ("Could not grab keyboard! (%s)", grab_string (status));
|
||||||
@ -303,7 +297,7 @@ grab_window_toggled (GtkToggleButton *button,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdk_device_ungrab (device, GDK_CURRENT_TIME);
|
gdk_seat_ungrab (seat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user