Merge branch 'wip/carlosg/tablet-fixes' into 'main'

Wayland tablet device modifier fixes

Closes #4103 and #4102

See merge request GNOME/gtk!4210
This commit is contained in:
Matthias Clasen 2021-12-02 16:34:35 +00:00
commit e64bb40d0b
2 changed files with 9 additions and 16 deletions

View File

@ -3606,6 +3606,10 @@ tablet_tool_handle_proximity_out (void *data,
g_object_unref (tablet->pointer_info.focus);
tablet->pointer_info.focus = NULL;
tablet->pointer_info.button_modifiers &=
~(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK |
GDK_BUTTON4_MASK | GDK_BUTTON5_MASK);
gdk_device_update_tool (tablet->stylus_device, NULL);
g_clear_object (&tablet->pointer_info.cursor);
}
@ -3621,7 +3625,6 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
GdkEventType evtype,
guint button)
{
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkEvent *event;
event = gdk_button_event_new (evtype,
@ -3629,7 +3632,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
tablet->logical_device,
tablet->current_tool->tool,
tablet->pointer_info.time,
device_get_modifiers (seat->logical_pointer),
device_get_modifiers (tablet->logical_device),
button,
tablet->pointer_info.surface_x,
tablet->pointer_info.surface_y,

View File

@ -194,16 +194,6 @@ gtk_gesture_stylus_new (void)
NULL);
}
static GdkEvent *
gesture_get_current_event (GtkGestureStylus *gesture)
{
GdkEventSequence *sequence;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
return gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
}
/**
* gtk_gesture_stylus_get_axis:
* @gesture: a `GtkGestureStylus`
@ -230,7 +220,7 @@ gtk_gesture_stylus_get_axis (GtkGestureStylus *gesture,
g_return_val_if_fail (axis < GDK_AXIS_LAST, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
event = gesture_get_current_event (gesture);
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
if (!event)
return FALSE;
@ -264,7 +254,7 @@ gtk_gesture_stylus_get_axes (GtkGestureStylus *gesture,
g_return_val_if_fail (GTK_IS_GESTURE_STYLUS (gesture), FALSE);
g_return_val_if_fail (values != NULL, FALSE);
event = gesture_get_current_event (gesture);
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
if (!event)
return FALSE;
@ -331,7 +321,7 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
g_return_val_if_fail (GTK_IS_GESTURE_STYLUS (gesture), FALSE);
g_return_val_if_fail (backlog != NULL && n_elems != NULL, FALSE);
event = gesture_get_current_event (gesture);
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
if (event && GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY))
history = gdk_event_get_history (event, &n_coords);
@ -391,7 +381,7 @@ gtk_gesture_stylus_get_device_tool (GtkGestureStylus *gesture)
g_return_val_if_fail (GTK_IS_GESTURE_STYLUS (gesture), FALSE);
event = gesture_get_current_event (gesture);
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
if (!event)
return NULL;