summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-07-29 00:03:48 +0200
committerCarlos Garnacho <carlosg@gnome.org>2020-07-29 01:27:51 +0200
commitcab1dcb6960d1efb4dee916a1c804c908664c530 (patch)
treee437b652ea6b2286e1b62e85f9e4cf8cca233257 /gtk
parent25ea17a6fc0035b5f7e190ed84107c0f8016aa09 (diff)
downloadgtk+-cab1dcb6960d1efb4dee916a1c804c908664c530.tar.gz
gdk: Conflate GDK devices
Make GdkEvents hold a single GdkDevice. This device is closer to the logical device conceptually, although it must be sufficient for device checks (i.e. GdkInputSource), which makes it similar to the physical devices. Make the logical devices have a more accurate GdkInputSource where needed, and conflate the event devices altogether.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkeventcontrollerscroll.c2
-rw-r--r--gtk/gtkflowbox.c2
-rw-r--r--gtk/gtkgesture.c2
-rw-r--r--gtk/gtkgestureclick.c2
-rw-r--r--gtk/gtkgesturesingle.c2
-rw-r--r--gtk/gtkimcontext.c1
-rw-r--r--gtk/gtkimcontextsimple.c1
-rw-r--r--gtk/gtklistbox.c2
-rw-r--r--gtk/gtkmain.c17
-rw-r--r--gtk/gtkpadcontroller.c4
-rw-r--r--gtk/gtkpaned.c2
-rw-r--r--gtk/gtkrange.c2
-rw-r--r--gtk/gtkscrolledwindow.c2
-rw-r--r--gtk/gtktext.c4
-rw-r--r--gtk/gtktextview.c6
-rw-r--r--gtk/gtktooltip.c2
-rw-r--r--gtk/gtkwidget.c3
17 files changed, 28 insertions, 28 deletions
diff --git a/gtk/gtkeventcontrollerscroll.c b/gtk/gtkeventcontrollerscroll.c
index b466bb74ee..46573ca7de 100644
--- a/gtk/gtkeventcontrollerscroll.c
+++ b/gtk/gtkeventcontrollerscroll.c
@@ -258,7 +258,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
direction = gdk_scroll_event_get_direction (event);
if (direction == GDK_SCROLL_SMOOTH)
{
- GdkDevice *device = gdk_event_get_source_device (event);
+ GdkDevice *device = gdk_event_get_device (event);
GdkInputSource input_source = gdk_device_get_source (device);
gdk_scroll_event_get_deltas (event, &dx, &dy);
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index ef4aaf809b..2a40252675 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2875,7 +2875,7 @@ gtk_flow_box_click_gesture_released (GtkGestureClick *gesture,
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
- source = gdk_device_get_source (gdk_event_get_source_device (event));
+ source = gdk_device_get_source (gdk_event_get_device (event));
if (source == GDK_SOURCE_TOUCHSCREEN)
modify = !modify;
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index 84944da8e3..ce40044901 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -611,7 +611,7 @@ gtk_gesture_handle_event (GtkEventController *controller,
GdkModifierType state;
GtkWidget *target;
- source_device = gdk_event_get_source_device (event);
+ source_device = gdk_event_get_device (event);
if (!source_device)
return FALSE;
diff --git a/gtk/gtkgestureclick.c b/gtk/gtkgestureclick.c
index 15039ab767..27f6e1367a 100644
--- a/gtk/gtkgestureclick.c
+++ b/gtk/gtkgestureclick.c
@@ -202,7 +202,7 @@ gtk_gesture_click_begin (GtkGesture *gesture,
priv = gtk_gesture_click_get_instance_private (click);
event = gtk_gesture_get_last_event (gesture, sequence);
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
- device = gdk_event_get_source_device (event);
+ device = gdk_event_get_device (event);
event_type = gdk_event_get_event_type (event);
if (event_type == GDK_BUTTON_PRESS)
diff --git a/gtk/gtkgesturesingle.c b/gtk/gtkgesturesingle.c
index 6e3dd3b406..3bd3a19573 100644
--- a/gtk/gtkgesturesingle.c
+++ b/gtk/gtkgesturesingle.c
@@ -143,7 +143,7 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
gboolean retval, test_touchscreen = FALSE;
GdkEventType event_type;
- source_device = gdk_event_get_source_device (event);
+ source_device = gdk_event_get_device (event);
if (!source_device)
return FALSE;
diff --git a/gtk/gtkimcontext.c b/gtk/gtkimcontext.c
index 00ff8f33df..b6997482ee 100644
--- a/gtk/gtkimcontext.c
+++ b/gtk/gtkimcontext.c
@@ -603,7 +603,6 @@ gtk_im_context_filter_key (GtkIMContext *context,
key = gdk_key_event_new (press ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
surface,
device,
- source_device,
time,
keycode,
state,
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index cf5669addd..65eaf25dbb 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -809,7 +809,6 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
GdkEvent *tmp_event = gdk_key_event_new (GDK_KEY_PRESS,
gdk_event_get_surface (event),
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_time (event),
priv->compose_buffer[len + i],
gdk_event_get_modifier_state (event),
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index fb06f24ed4..a95c87457a 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1849,7 +1849,7 @@ gtk_list_box_click_gesture_released (GtkGestureClick *gesture,
state = gdk_event_get_modifier_state (event);
extend = (state & GDK_SHIFT_MASK) != 0;
modify = (state & GDK_CONTROL_MASK) != 0;
- source = gdk_device_get_source (gdk_event_get_source_device (event));
+ source = gdk_device_get_source (gdk_event_get_device (event));
if (source == GDK_SOURCE_TOUCHSCREEN)
modify = !modify;
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 30d6d20d09..b114de5bc0 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1127,7 +1127,6 @@ rewrite_event_for_surface (GdkEvent *event,
return gdk_button_event_new (type,
new_surface,
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
@@ -1137,7 +1136,6 @@ rewrite_event_for_surface (GdkEvent *event,
case GDK_MOTION_NOTIFY:
return gdk_motion_event_new (new_surface,
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
@@ -1151,7 +1149,6 @@ rewrite_event_for_surface (GdkEvent *event,
gdk_event_get_event_sequence (event),
new_surface,
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
x, y,
@@ -1161,7 +1158,6 @@ rewrite_event_for_surface (GdkEvent *event,
gdk_touchpad_event_get_deltas (event, &dx, &dy);
return gdk_touchpad_event_new_swipe (new_surface,
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_touchpad_event_get_gesture_phase (event),
@@ -1172,7 +1168,6 @@ rewrite_event_for_surface (GdkEvent *event,
gdk_touchpad_event_get_deltas (event, &dx, &dy);
return gdk_touchpad_event_new_pinch (new_surface,
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_touchpad_event_get_gesture_phase (event),
@@ -1266,7 +1261,6 @@ rewrite_event_for_toplevel (GdkEvent *event)
return gdk_key_event_new (gdk_event_get_event_type (event),
surface,
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_key_event_get_keycode (event),
gdk_event_get_modifier_state (event),
@@ -1542,6 +1536,17 @@ handle_pointing_event (GdkEvent *event)
type = gdk_event_get_event_type (event);
sequence = gdk_event_get_event_sequence (event);
+ if (type == GDK_SCROLL &&
+ (gdk_device_get_source (device) == GDK_SOURCE_TOUCHPAD ||
+ gdk_device_get_source (device) == GDK_SOURCE_TRACKPOINT ||
+ gdk_device_get_source (device) == GDK_SOURCE_MOUSE))
+ {
+ /* A bit of a kludge, resolve target lookups for scrolling devices
+ * on the seat pointer.
+ */
+ device = gdk_seat_get_pointer (gdk_event_get_seat (event));
+ }
+
switch ((guint) type)
{
case GDK_LEAVE_NOTIFY:
diff --git a/gtk/gtkpadcontroller.c b/gtk/gtkpadcontroller.c
index df589682ad..dbda9027cd 100644
--- a/gtk/gtkpadcontroller.c
+++ b/gtk/gtkpadcontroller.c
@@ -210,7 +210,7 @@ gtk_pad_controller_filter_event (GtkEventController *controller,
return TRUE;
if (pad_controller->pad &&
- gdk_event_get_source_device (event) != pad_controller->pad)
+ gdk_event_get_device (event) != pad_controller->pad)
return TRUE;
return FALSE;
@@ -233,7 +233,7 @@ gtk_pad_controller_handle_event (GtkEventController *controller,
if (event_type == GDK_PAD_GROUP_MODE)
{
gtk_pad_controller_handle_mode_switch (pad_controller,
- gdk_event_get_source_device (event),
+ gdk_event_get_device (event),
group,
mode);
return GDK_EVENT_PROPAGATE;
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 83b6e280b6..cd0676e824 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -873,7 +873,7 @@ gesture_drag_begin_cb (GtkGestureDrag *gesture,
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
- device = gdk_event_get_source_device (event);
+ device = gdk_event_get_device (event);
paned->panning = FALSE;
is_touch = (gdk_event_get_event_type (event) == GDK_TOUCH_BEGIN ||
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 0277fc8c4a..ef8b1f4f91 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1881,7 +1881,7 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
state_mask = gdk_event_get_modifier_state (event);
shift_pressed = (state_mask & GDK_SHIFT_MASK) != 0;
- source_device = gdk_event_get_source_device ((GdkEvent *) event);
+ source_device = gdk_event_get_device ((GdkEvent *) event);
source = gdk_device_get_source (source_device);
g_object_get (gtk_widget_get_settings (widget),
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index e9c62dbcf8..2a120a716f 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1254,7 +1254,7 @@ captured_motion (GtkEventController *controller,
state = gtk_event_controller_get_current_event_state (controller);
event = gtk_event_controller_get_current_event (controller);
- source_device = gdk_event_get_source_device (event);
+ source_device = gdk_event_get_device (event);
input_source = gdk_device_get_source (source_device);
if (priv->hscrollbar_visible)
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 2d2985978f..4317654df1 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2714,7 +2714,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
sel_end = priv->current_pos;
have_selection = sel_start != sel_end;
- source = gdk_event_get_source_device (event);
+ source = gdk_event_get_device (event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
@@ -2991,7 +2991,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
else
tmp_pos = gtk_text_find_position (self, x);
- source = gdk_event_get_source_device (event);
+ source = gdk_event_get_device (event);
input_source = gdk_device_get_source (source);
if (priv->select_words)
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 707aac23f4..8be1e73a86 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5384,7 +5384,7 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
GTK_EVENT_SEQUENCE_CLAIMED);
gtk_text_view_reset_blink_time (text_view);
- device = gdk_event_get_source_device ((GdkEvent *) event);
+ device = gdk_event_get_device ((GdkEvent *) event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
@@ -7220,7 +7220,7 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
drag_gesture_get_text_surface_coords (gesture, text_view,
&start_x, &start_y, &x, &y);
- device = gdk_event_get_source_device (event);
+ device = gdk_event_get_device (event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
@@ -7355,7 +7355,7 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
return;
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
- device = gdk_event_get_source_device (event);
+ device = gdk_event_get_device (event);
is_touchscreen = gtk_simulate_touchscreen () ||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 27ab711ef5..284e96d912 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -897,7 +897,7 @@ tooltips_enabled (GdkEvent *event)
GDK_BUTTON5_MASK)) != 0)
return FALSE;
- source_device = gdk_event_get_source_device (event);
+ source_device = gdk_event_get_device (event);
if (!source_device)
return FALSE;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e02699a336..69de2d5ddd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -1922,7 +1922,6 @@ _gtk_widget_emulate_press (GtkWidget *widget,
gdk_event_get_event_sequence (event),
gdk_event_get_surface (event),
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
p.x, p.y,
@@ -1934,7 +1933,6 @@ _gtk_widget_emulate_press (GtkWidget *widget,
press = gdk_button_event_new (GDK_BUTTON_PRESS,
gdk_event_get_surface (event),
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
@@ -1960,7 +1958,6 @@ _gtk_widget_emulate_press (GtkWidget *widget,
press = gdk_button_event_new (GDK_BUTTON_PRESS,
gdk_event_get_surface (event),
gdk_event_get_device (event),
- gdk_event_get_source_device (event),
gdk_event_get_device_tool (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),