[gtk/getters-and-setters: 1/3] gdk: Drop GdkDevice::input-mode and rename ::input-source
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/getters-and-setters: 1/3] gdk: Drop GdkDevice::input-mode and rename ::input-source
- Date: Mon, 24 Feb 2020 18:49:35 +0000 (UTC)
commit 4871600a7ad8da5e5d1e83a3e5ee8d8e52baccd0
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Feb 24 13:35:27 2020 -0500
gdk: Drop GdkDevice::input-mode and rename ::input-source
Drop the input-mode, since it only makes sense for
floating devices, which we don't have anymore. And renamt
::input-source to ::source, to match the getter.
Update all users.
gdk/broadway/gdkdisplay-broadway.c | 9 ++--
gdk/gdkdevice.c | 87 +++-----------------------------------
gdk/gdkdevice.h | 27 +-----------
gdk/gdkdeviceprivate.h | 1 -
gdk/gdksurface.c | 7 +--
gdk/wayland/gdkdevice-wayland.c | 39 ++++++-----------
gdk/x11/gdkdevice-xi2.c | 3 --
gdk/x11/gdkdevicemanager-xi2.c | 67 +++++------------------------
8 files changed, 37 insertions(+), 203 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index f5b3d4145b..3beefc4636 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -110,8 +110,7 @@ create_core_pointer (GdkDisplay *display)
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
NULL);
@@ -123,8 +122,7 @@ create_core_keyboard (GdkDisplay *display)
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_KEYBOARD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
NULL);
@@ -136,8 +134,7 @@ create_touchscreen (GdkDisplay *display)
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Touchscreen",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TOUCHSCREEN,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", display,
NULL);
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 725366f0e2..9665ca469f 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -93,7 +93,6 @@ enum {
PROP_ASSOCIATED_DEVICE,
PROP_TYPE,
PROP_SOURCE,
- PROP_MODE,
PROP_HAS_CURSOR,
PROP_N_AXES,
PROP_VENDOR_ID,
@@ -182,19 +181,6 @@ gdk_device_class_init (GdkDeviceClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
- /*
- * GdkDevice:mode:
- *
- * Input mode for the device.
- */
- device_props[PROP_MODE] =
- g_param_spec_enum ("mode",
- P_("Input mode for the device"),
- P_("Input mode for the device"),
- GDK_TYPE_INPUT_MODE,
- GDK_MODE_DISABLED,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
-
/**
* GdkDevice:has-cursor:
*
@@ -417,9 +403,6 @@ gdk_device_set_property (GObject *object,
case PROP_SOURCE:
device->source = g_value_get_enum (value);
break;
- case PROP_MODE:
- gdk_device_set_mode (device, g_value_get_enum (value));
- break;
case PROP_HAS_CURSOR:
device->has_cursor = g_value_get_boolean (value);
break;
@@ -466,9 +449,6 @@ gdk_device_get_property (GObject *object,
case PROP_SOURCE:
g_value_set_enum (value, device->source);
break;
- case PROP_MODE:
- g_value_set_enum (value, device->mode);
- break;
case PROP_HAS_CURSOR:
g_value_set_boolean (value, device->has_cursor);
break;
@@ -727,56 +707,6 @@ gdk_device_get_source (GdkDevice *device)
return device->source;
}
-/**
- * gdk_device_get_mode:
- * @device: a #GdkDevice
- *
- * Determines the mode of the device.
- *
- * Returns: a #GdkInputMode
- **/
-GdkInputMode
-gdk_device_get_mode (GdkDevice *device)
-{
- g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
-
- return device->mode;
-}
-
-/**
- * gdk_device_set_mode:
- * @device: a #GdkDevice.
- * @mode: the input mode.
- *
- * Sets a the mode of an input device. The mode controls if the
- * device is active and whether the device’s range is mapped to the
- * entire screen or to a single surface.
- *
- * Note: This is only meaningful for floating devices, master devices (and
- * slaves connected to these) drive the pointer cursor, which is not limited
- * by the input mode.
- *
- * Returns: %TRUE if the mode was successfully changed.
- **/
-gboolean
-gdk_device_set_mode (GdkDevice *device,
- GdkInputMode mode)
-{
- g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
-
- if (device->mode == mode)
- return TRUE;
-
- if (mode == GDK_MODE_DISABLED &&
- gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
- return FALSE;
-
- device->mode = mode;
- g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_MODE]);
-
- return TRUE;
-}
-
/**
* gdk_device_get_n_keys:
* @device: a #GdkDevice
@@ -866,7 +796,7 @@ gdk_device_get_axis_use (GdkDevice *device,
GdkAxisInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE);
g_return_val_if_fail (index_ < device->axes->len, GDK_AXIS_IGNORE);
info = &g_array_index (device->axes, GdkAxisInfo, index_);
@@ -890,7 +820,7 @@ gdk_device_set_axis_use (GdkDevice *device,
GdkAxisInfo *info;
g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
+ g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
g_return_if_fail (index_ < device->axes->len);
info = &g_array_index (device->axes, GdkAxisInfo, index_);
@@ -1075,7 +1005,7 @@ gint
gdk_device_get_n_axes (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, 0);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, 0);
return device->axes->len;
}
@@ -1098,7 +1028,7 @@ gdk_device_get_axis_names (GdkDevice *device)
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
if (device->axes->len == 0)
return NULL;
@@ -1140,7 +1070,7 @@ gdk_device_get_axis_value (GdkDevice *device,
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
@@ -1184,7 +1114,7 @@ gdk_device_get_axis (GdkDevice *device,
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
@@ -1506,9 +1436,6 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
GdkAxisInfo axis_info;
gdouble axis_width, scale, offset;
- if (device->mode != GDK_MODE_SCREEN)
- return FALSE;
-
if (index_ >= device->axes->len)
return FALSE;
@@ -1626,7 +1553,7 @@ gdk_device_get_last_event_surface (GdkDevice *device)
GdkPointerSurfaceInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
+ g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
display = gdk_device_get_display (device);
info = _gdk_display_get_pointer_info (display, device);
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index d69e18ca21..3229a0b5af 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -69,25 +69,6 @@ typedef enum
GDK_SOURCE_TABLET_PAD
} GdkInputSource;
-/**
- * GdkInputMode:
- * @GDK_MODE_DISABLED: the device is disabled and will not report any events.
- * @GDK_MODE_SCREEN: the device is enabled. The device’s coordinate space
- * maps to the entire screen.
- * @GDK_MODE_SURFACE: the device is enabled. The device’s coordinate space
- * is mapped to a single surface. The manner in which this surface
- * is chosen is undefined, but it will typically be the same
- * way in which the focus surface for key events is determined.
- *
- * An enumeration that describes the mode of an input device.
- */
-typedef enum
-{
- GDK_MODE_DISABLED,
- GDK_MODE_SCREEN,
- GDK_MODE_SURFACE
-} GdkInputMode;
-
/**
* GdkDeviceType:
* @GDK_DEVICE_TYPE_MASTER: Device is a master (or virtual) device. There will
@@ -132,13 +113,7 @@ gboolean gdk_device_get_has_cursor (GdkDevice *device);
/* Functions to configure a device */
GDK_AVAILABLE_IN_ALL
-GdkInputSource gdk_device_get_source (GdkDevice *device);
-
-GDK_AVAILABLE_IN_ALL
-GdkInputMode gdk_device_get_mode (GdkDevice *device);
-GDK_AVAILABLE_IN_ALL
-gboolean gdk_device_set_mode (GdkDevice *device,
- GdkInputMode mode);
+GdkInputSource gdk_device_get_source (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_keys (GdkDevice *device);
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index aab3166d2b..9135edaac2 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -44,7 +44,6 @@ struct _GdkDevice
gchar *name;
GdkInputSource source;
- GdkInputMode mode;
gboolean has_cursor;
gint num_keys;
GdkAxisFlags axis_flags;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index dfdc9c0cb1..a9ea5bcffa 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2695,12 +2695,9 @@ _gdk_windowing_got_event (GdkDisplay *display,
_gdk_display_device_grab_update (display, device, source_device, serial);
- if (gdk_device_get_mode (device) == GDK_MODE_DISABLED ||
- !_gdk_display_check_grab_ownership (display, device, serial))
+ if (!_gdk_display_check_grab_ownership (display, device, serial))
{
- /* Device events are blocked by another
- * device grab, or the device is disabled
- */
+ /* Device events are blocked by another device grab */
unlink_event = TRUE;
goto out;
}
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 26f9b142c5..c18b0e1eaf 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2780,8 +2780,7 @@ tablet_handle_done (void *data,
master = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", master_name,
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
"seat", seat,
@@ -2793,8 +2792,7 @@ tablet_handle_done (void *data,
stylus_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", tablet->name,
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_PEN,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_PEN,
"has-cursor", FALSE,
"display", display,
"seat", seat,
@@ -2805,8 +2803,7 @@ tablet_handle_done (void *data,
eraser_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", eraser_name,
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_ERASER,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_ERASER,
"has-cursor", FALSE,
"display", display,
"seat", seat,
@@ -2915,8 +2912,7 @@ seat_handle_capabilities (void *data,
seat->pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Pointer",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@@ -2986,8 +2982,7 @@ seat_handle_capabilities (void *data,
seat->keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Keyboard",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_KEYBOARD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
@@ -3015,8 +3010,7 @@ seat_handle_capabilities (void *data,
seat->touch_master = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch Master Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@@ -3028,8 +3022,7 @@ seat_handle_capabilities (void *data,
seat->touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TOUCHSCREEN,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
@@ -3066,8 +3059,7 @@ get_scroll_device (GdkWaylandSeat *seat,
seat->wheel_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Wheel Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@@ -3083,8 +3075,7 @@ get_scroll_device (GdkWaylandSeat *seat,
seat->finger_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Finger Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TOUCHPAD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TOUCHPAD,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@@ -3100,8 +3091,7 @@ get_scroll_device (GdkWaylandSeat *seat,
seat->continuous_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Continuous Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TRACKPOINT,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TRACKPOINT,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@@ -4102,8 +4092,7 @@ tablet_pad_handle_done (void *data,
g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
"name", "Pad device",
"type", GDK_DEVICE_TYPE_SLAVE,
- "input-source", GDK_SOURCE_TABLET_PAD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_TABLET_PAD,
"display", gdk_seat_get_display (pad->seat),
"seat", pad->seat,
NULL);
@@ -4281,8 +4270,7 @@ init_devices (GdkWaylandSeat *seat)
seat->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_MOUSE,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@@ -4294,8 +4282,7 @@ init_devices (GdkWaylandSeat *seat)
seat->master_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER,
- "input-source", GDK_SOURCE_KEYBOARD,
- "input-mode", GDK_MODE_SCREEN,
+ "source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index f6b94da061..40c0e8bb07 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -230,9 +230,6 @@ gdk_x11_device_xi2_get_state (GdkDevice *device,
case GDK_AXIS_X:
case GDK_AXIS_Y:
case GDK_AXIS_IGNORE:
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- _gdk_device_translate_surface_coord (device, surface, j, value, &axes[j]);
- else
{
gint root_x, root_y;
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index e22dbfd3eb..e4dadee359 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -473,7 +473,6 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
GdkInputSource touch_source;
GdkDeviceType type;
GdkDevice *device;
- GdkInputMode mode;
gint num_touches = 0;
gchar *vendor_id = NULL, *product_id = NULL;
@@ -520,17 +519,14 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
case XIMasterKeyboard:
case XIMasterPointer:
type = GDK_DEVICE_TYPE_MASTER;
- mode = GDK_MODE_SCREEN;
break;
case XISlaveKeyboard:
case XISlavePointer:
type = GDK_DEVICE_TYPE_SLAVE;
- mode = GDK_MODE_DISABLED;
break;
case XIFloatingSlave:
default:
type = GDK_DEVICE_TYPE_FLOATING;
- mode = GDK_MODE_DISABLED;
break;
}
@@ -538,12 +534,10 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
({
const gchar *type_names[] = { "master", "slave", "floating" };
const gchar *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct
touch", "indirect touch", "trackpoint", "pad" };
- const gchar *mode_names[] = { "disabled", "screen", "window" };
- g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\tmode: %s\n\thas cursor:
%d\n\ttouches: %d",
+ g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches:
%d",
dev->name,
type_names[type],
source_names[input_source],
- mode_names[mode],
dev->use == XIMasterPointer,
num_touches);
}));
@@ -555,8 +549,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
device = g_object_new (GDK_TYPE_X11_DEVICE_XI2,
"name", dev->name,
"type", type,
- "input-source", input_source,
- "input-mode", mode,
+ "source", input_source,
"has-cursor", (dev->use == XIMasterPointer),
"display", display,
"device-id", dev->deviceid,
@@ -1228,9 +1221,6 @@ translate_axes (GdkDevice *device,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- _gdk_device_translate_surface_coord (device, surface, i, val, &axes[i]);
- else
{
if (use == GDK_AXIS_X)
axes[i] = x;
@@ -1661,17 +1651,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
event = gdk_event_button_new (ev->evtype == XI_ButtonPress
? GDK_BUTTON_PRESS
@@ -1746,17 +1727,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
event = gdk_event_motion_new (surface,
device,
@@ -1803,17 +1775,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
+
event = gdk_event_touch_new (ev->evtype == XI_TouchBegin
? GDK_TOUCH_BEGIN
: GDK_TOUCH_END,
@@ -1861,17 +1825,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
- if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
- {
- /* Update event coordinates from axes */
- gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
- gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
- }
- else
- {
- x = (double) xev->event_x / scale;
- y = (double) xev->event_y / scale;
- }
+ x = (double) xev->event_x / scale;
+ y = (double) xev->event_y / scale;
event = gdk_event_touch_new (GDK_TOUCH_UPDATE,
GUINT_TO_POINTER (xev->detail),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]