forked from AuroraMiddleware/gtk
tests: Avoid deprecated API usage in testgtk
We can use seat grabs here.
This commit is contained in:
parent
a74db1de77
commit
cf4e179a45
@ -6949,14 +6949,10 @@ shape_pressed (GtkWidget *widget, GdkEventButton *event)
|
|||||||
p->y = (int) event->y;
|
p->y = (int) event->y;
|
||||||
|
|
||||||
gtk_grab_add (widget);
|
gtk_grab_add (widget);
|
||||||
gdk_device_grab (gdk_event_get_device ((GdkEvent*)event),
|
gdk_seat_grab (gdk_event_get_seat ((GdkEvent *) event),
|
||||||
gtk_widget_get_window (widget),
|
gtk_widget_get_window (widget),
|
||||||
GDK_OWNERSHIP_NONE,
|
GDK_SEAT_CAPABILITY_ALL_POINTING,
|
||||||
TRUE,
|
TRUE, NULL, (GdkEvent *) event, NULL, NULL);
|
||||||
GDK_BUTTON_RELEASE_MASK |
|
|
||||||
GDK_BUTTON_MOTION_MASK,
|
|
||||||
NULL,
|
|
||||||
event->time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -6964,7 +6960,7 @@ shape_released (GtkWidget *widget,
|
|||||||
GdkEventButton *event)
|
GdkEventButton *event)
|
||||||
{
|
{
|
||||||
gtk_grab_remove (widget);
|
gtk_grab_remove (widget);
|
||||||
gdk_device_ungrab (gdk_event_get_device ((GdkEvent*)event), event->time);
|
gdk_seat_ungrab (gdk_event_get_seat ((GdkEvent *) event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -8677,8 +8673,7 @@ snapshot_widget_event (GtkWidget *widget,
|
|||||||
if (event->type == GDK_BUTTON_RELEASE)
|
if (event->type == GDK_BUTTON_RELEASE)
|
||||||
{
|
{
|
||||||
gtk_grab_remove (widget);
|
gtk_grab_remove (widget);
|
||||||
gdk_device_ungrab (gdk_event_get_device (event),
|
gdk_seat_ungrab (gdk_event_get_seat (event));
|
||||||
GDK_CURRENT_TIME);
|
|
||||||
|
|
||||||
res_widget = find_widget_at_pointer (gdk_event_get_device (event));
|
res_widget = find_widget_at_pointer (gdk_event_get_device (event));
|
||||||
if (data->is_toplevel && res_widget)
|
if (data->is_toplevel && res_widget)
|
||||||
@ -8730,22 +8725,16 @@ snapshot_widget (GtkButton *button,
|
|||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
|
||||||
device = gdk_device_get_associated_device (device);
|
|
||||||
|
|
||||||
data->is_toplevel = widget == data->toplevel_button;
|
data->is_toplevel = widget == data->toplevel_button;
|
||||||
|
|
||||||
if (!data->cursor)
|
if (!data->cursor)
|
||||||
data->cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
|
data->cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
|
||||||
GDK_TARGET);
|
GDK_TARGET);
|
||||||
|
|
||||||
gdk_device_grab (device,
|
gdk_seat_grab (gdk_device_get_seat (device),
|
||||||
gtk_widget_get_window (widget),
|
gtk_widget_get_window (widget),
|
||||||
GDK_OWNERSHIP_APPLICATION,
|
GDK_SEAT_CAPABILITY_ALL_POINTING,
|
||||||
TRUE,
|
TRUE, data->cursor, NULL, NULL, NULL);
|
||||||
GDK_BUTTON_RELEASE_MASK,
|
|
||||||
data->cursor,
|
|
||||||
GDK_CURRENT_TIME);
|
|
||||||
|
|
||||||
g_signal_connect (button, "event",
|
g_signal_connect (button, "event",
|
||||||
G_CALLBACK (snapshot_widget_event), data);
|
G_CALLBACK (snapshot_widget_event), data);
|
||||||
|
Loading…
Reference in New Issue
Block a user