diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-07-30 17:46:49 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-07-30 18:44:40 +0200 |
commit | 46eb0543373a7734e5ddeed7aa0a877af3bcf2ad (patch) | |
tree | c7f4034140e4ea9963bf9e125a49d5124b675375 /gdk | |
parent | 4a2050e220adabd09ecfadac99f208dc31b5ff12 (diff) | |
download | gtk+-46eb0543373a7734e5ddeed7aa0a877af3bcf2ad.tar.gz |
gdk: Drop gdk_device_get_device_type()
There is no longer a hierarchy of devices, or none that is seen
on the outside.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/broadway/gdkdisplay-broadway.c | 5 | ||||
-rw-r--r-- | gdk/gdkdevice.c | 82 | ||||
-rw-r--r-- | gdk/gdkdevice.h | 20 | ||||
-rw-r--r-- | gdk/gdkdeviceprivate.h | 1 | ||||
-rw-r--r-- | gdk/gdkdisplay.c | 7 | ||||
-rw-r--r-- | gdk/gdksurface.c | 2 | ||||
-rw-r--r-- | gdk/macos/gdkmacosseat.c | 2 | ||||
-rw-r--r-- | gdk/wayland/gdkdevice-wayland.c | 12 | ||||
-rw-r--r-- | gdk/win32/gdkdevicemanager-win32.c | 20 |
9 files changed, 11 insertions, 140 deletions
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index 5b406e3e15..3f881426eb 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -119,7 +119,6 @@ create_core_pointer (GdkDisplay *display) { return g_object_new (GDK_TYPE_BROADWAY_DEVICE, "name", "Core Pointer", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_MOUSE, "has-cursor", TRUE, "display", display, @@ -131,7 +130,6 @@ create_core_keyboard (GdkDisplay *display) { return g_object_new (GDK_TYPE_BROADWAY_DEVICE, "name", "Core Keyboard", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_KEYBOARD, "has-cursor", FALSE, "display", display, @@ -143,7 +141,6 @@ create_pointer (GdkDisplay *display) { return g_object_new (GDK_TYPE_BROADWAY_DEVICE, "name", "Pointer", - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_MOUSE, "has-cursor", TRUE, "display", display, @@ -155,7 +152,6 @@ create_keyboard (GdkDisplay *display) { return g_object_new (GDK_TYPE_BROADWAY_DEVICE, "name", "Keyboard", - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_KEYBOARD, "has-cursor", FALSE, "display", display, @@ -167,7 +163,6 @@ create_touchscreen (GdkDisplay *display) { return g_object_new (GDK_TYPE_BROADWAY_DEVICE, "name", "Touchscreen", - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_TOUCHSCREEN, "has-cursor", FALSE, "display", display, diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index dabefc992d..3dbc4ec2c4 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -86,7 +86,6 @@ enum { PROP_0, PROP_DISPLAY, PROP_NAME, - PROP_TYPE, PROP_SOURCE, PROP_HAS_CURSOR, PROP_N_AXES, @@ -140,19 +139,6 @@ gdk_device_class_init (GdkDeviceClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - /** - * GdkDevice:type: - * - * Device role in the device manager. - */ - device_props[PROP_TYPE] = - g_param_spec_enum ("type", - P_("Device type"), - P_("Device role in the device manager"), - GDK_TYPE_DEVICE_TYPE, - GDK_DEVICE_TYPE_LOGICAL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS); /** * GdkDevice:source: @@ -171,8 +157,7 @@ gdk_device_class_init (GdkDeviceClass *klass) /** * GdkDevice:has-cursor: * - * Whether the device is represented by a cursor on the screen. Devices of type - * %GDK_DEVICE_TYPE_LOGICAL will have %TRUE here. + * Whether the device is represented by a cursor on the screen. */ device_props[PROP_HAS_CURSOR] = g_param_spec_boolean ("has-cursor", @@ -368,15 +353,14 @@ gdk_device_dispose (GObject *object) GdkDevice *device = GDK_DEVICE (object); GdkDevice *associated = device->associated; - if (associated && device->type == GDK_DEVICE_TYPE_PHYSICAL) + if (associated) _gdk_device_remove_physical_device (associated, device); if (associated) { device->associated = NULL; - if (device->type == GDK_DEVICE_TYPE_LOGICAL && - associated->associated == device) + if (associated->associated == device) _gdk_device_set_associated_device (associated, NULL); g_object_unref (associated); @@ -405,9 +389,6 @@ gdk_device_set_property (GObject *object, device->name = g_value_dup_string (value); break; - case PROP_TYPE: - device->type = g_value_get_enum (value); - break; case PROP_SOURCE: device->source = g_value_get_enum (value); break; @@ -448,9 +429,6 @@ gdk_device_get_property (GObject *object, case PROP_NAME: g_value_set_string (value, device->name); break; - case PROP_TYPE: - g_value_set_enum (value, device->type); - break; case PROP_SOURCE: g_value_set_enum (value, device->source); break; @@ -514,8 +492,6 @@ gdk_device_get_position (GdkDevice *device, { g_return_if_fail (GDK_IS_DEVICE (device)); g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD); - g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL || - gdk_display_device_is_grabbed (gdk_device_get_display (device), device)); _gdk_device_query_state (device, NULL, NULL, x, y, NULL); } @@ -532,10 +508,6 @@ gdk_device_get_position (GdkDevice *device, * double precision. Returns %NULL if the surface tree under @device is not known to GDK (for example, * belongs to another application). * - * As a physical device coordinates are those of its logical pointer, this - * function may not be called on devices of type %GDK_DEVICE_TYPE_PHYSICAL, - * unless there is an ongoing grab on them, see gdk_seat_grab(). - * * Returns: (nullable) (transfer none): the #GdkSurface under the * device position, or %NULL. **/ @@ -549,8 +521,6 @@ gdk_device_get_surface_at_position (GdkDevice *device, g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL); - g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL || - gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL); surface = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL); @@ -652,18 +622,6 @@ gdk_device_get_display (GdkDevice *device) return device->display; } -static void -_gdk_device_set_device_type (GdkDevice *device, - GdkDeviceType type) -{ - if (device->type != type) - { - device->type = type; - - g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_TYPE]); - } -} - void _gdk_device_set_associated_device (GdkDevice *device, GdkDevice *associated) @@ -682,14 +640,6 @@ _gdk_device_set_associated_device (GdkDevice *device, if (associated) device->associated = g_object_ref (associated); - - if (device->type != GDK_DEVICE_TYPE_LOGICAL) - { - if (device->associated) - _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_PHYSICAL); - else - _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_FLOATING); - } } /** @@ -706,7 +656,6 @@ GList * gdk_device_list_physical_devices (GdkDevice *device) { g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); - g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL, NULL); return g_list_copy (device->physical_devices); } @@ -715,9 +664,6 @@ void _gdk_device_add_physical_device (GdkDevice *device, GdkDevice *physical) { - g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL); - g_return_if_fail (gdk_device_get_device_type (physical) != GDK_DEVICE_TYPE_LOGICAL); - if (!g_list_find (device->physical_devices, physical)) device->physical_devices = g_list_prepend (device->physical_devices, physical); } @@ -728,9 +674,6 @@ _gdk_device_remove_physical_device (GdkDevice *device, { GList *elem; - g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL); - g_return_if_fail (gdk_device_get_device_type (physical) != GDK_DEVICE_TYPE_LOGICAL); - elem = g_list_find (device->physical_devices, physical); if (elem == NULL) return; @@ -739,22 +682,6 @@ _gdk_device_remove_physical_device (GdkDevice *device, } /** - * gdk_device_get_device_type: - * @device: a #GdkDevice - * - * Returns the device type for @device. - * - * Returns: the #GdkDeviceType for @device. - **/ -GdkDeviceType -gdk_device_get_device_type (GdkDevice *device) -{ - g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_LOGICAL); - - return device->type; -} - -/** * gdk_device_get_n_axes: * @device: a pointer #GdkDevice * @@ -1225,7 +1152,6 @@ const char * gdk_device_get_vendor_id (GdkDevice *device) { g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); - g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL); return device->vendor_id; } @@ -1244,7 +1170,6 @@ const char * gdk_device_get_product_id (GdkDevice *device) { g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); - g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL); return device->product_id; } @@ -1285,7 +1210,6 @@ gdk_device_update_tool (GdkDevice *device, GdkDeviceTool *tool) { g_return_if_fail (GDK_IS_DEVICE (device)); - g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL); if (g_set_object (&device->last_tool, tool)) { diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h index 1c7d390868..9501041aa7 100644 --- a/gdk/gdkdevice.h +++ b/gdk/gdkdevice.h @@ -63,23 +63,6 @@ typedef enum } GdkInputSource; /** - * GdkDeviceType: - * @GDK_DEVICE_TYPE_LOGICAL: Device is a logical device. There will - * be an associated focus indicator on the screen. - * @GDK_DEVICE_TYPE_PHYSICAL: Device is a physical device. - * @GDK_DEVICE_TYPE_FLOATING: Device is a physical device, currently - * not attached to any seat. - * - * Indicates the device type. - */ -typedef enum { - GDK_DEVICE_TYPE_LOGICAL, - GDK_DEVICE_TYPE_PHYSICAL, - GDK_DEVICE_TYPE_FLOATING -} GdkDeviceType; - - -/** * GdkTimeCoord: * @time: The timestamp for this event. * @flags: Flags indicating what axes are present @@ -115,9 +98,6 @@ GDK_AVAILABLE_IN_ALL GdkDisplay * gdk_device_get_display (GdkDevice *device); GDK_AVAILABLE_IN_ALL -GdkDeviceType gdk_device_get_device_type (GdkDevice *device); - -GDK_AVAILABLE_IN_ALL const char *gdk_device_get_vendor_id (GdkDevice *device); GDK_AVAILABLE_IN_ALL const char *gdk_device_get_product_id (GdkDevice *device); diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h index 1c802be7e4..c2d49fe068 100644 --- a/gdk/gdkdeviceprivate.h +++ b/gdk/gdkdeviceprivate.h @@ -39,7 +39,6 @@ struct _GdkDevice char *name; GdkInputSource source; gboolean has_cursor; - GdkDeviceType type; GdkDisplay *display; /* The paired logical device for logical devices, * or the associated logical device for physical ones diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index 14abf69c73..c24d1216be 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -639,12 +639,7 @@ switch_to_pointer_grab (GdkDisplay *display, if (grab == NULL /* ungrab */ || (!last_grab->owner_events && grab->owner_events) /* switched to owner_events */ ) { - /* Ungrabbed physical devices don't have a position by - * itself, rather depend on its logical pointer, so - * it doesn't make sense to track any position for - * these after the grab - */ - if (grab || gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL) + if (grab) new_toplevel = get_current_toplevel (display, device, &x, &y, &state); if (new_toplevel) diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 944b34ab4d..6cbbe391ee 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -1840,7 +1840,6 @@ gdk_surface_get_device_cursor (GdkSurface *surface, g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL); 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 (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL, NULL); return g_hash_table_lookup (surface->device_cursor, device); } @@ -1866,7 +1865,6 @@ gdk_surface_set_device_cursor (GdkSurface *surface, g_return_if_fail (GDK_IS_SURFACE (surface)); g_return_if_fail (GDK_IS_DEVICE (device)); g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD); - g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL); if (!cursor) g_hash_table_remove (surface->device_cursor, device); diff --git a/gdk/macos/gdkmacosseat.c b/gdk/macos/gdkmacosseat.c index cb3c3747e1..e239c6cb3c 100644 --- a/gdk/macos/gdkmacosseat.c +++ b/gdk/macos/gdkmacosseat.c @@ -38,14 +38,12 @@ _gdk_macos_seat_new (GdkMacosDisplay *display) core_pointer = g_object_new (GDK_TYPE_MACOS_DEVICE, "name", "Core Pointer", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_MOUSE, "has-cursor", TRUE, "display", display, NULL); core_keyboard = g_object_new (GDK_TYPE_MACOS_DEVICE, "name", "Core Keyboard", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_KEYBOARD, "has-cursor", FALSE, "display", display, diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index d503f6cf93..bf04b19142 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -2823,7 +2823,6 @@ tablet_handle_done (void *data, logical_name = g_strdup_printf ("Logical pointer for %s", tablet->name); logical_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", logical_name, - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_MOUSE, "has-cursor", TRUE, "display", display, @@ -2833,7 +2832,6 @@ tablet_handle_done (void *data, stylus_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", tablet->name, - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_PEN, "has-cursor", FALSE, "display", display, @@ -2938,7 +2936,6 @@ seat_handle_capabilities (void *data, seat->pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Wayland Pointer", - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_MOUSE, "has-cursor", TRUE, "display", seat->display, @@ -3008,7 +3005,6 @@ seat_handle_capabilities (void *data, seat->keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Wayland Keyboard", - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_KEYBOARD, "has-cursor", FALSE, "display", seat->display, @@ -3036,7 +3032,6 @@ seat_handle_capabilities (void *data, seat->logical_touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Wayland Touch Logical Pointer", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_TOUCHSCREEN, "has-cursor", TRUE, "display", seat->display, @@ -3048,7 +3043,6 @@ seat_handle_capabilities (void *data, seat->touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Wayland Touch", - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_TOUCHSCREEN, "has-cursor", FALSE, "display", seat->display, @@ -3085,7 +3079,6 @@ get_scroll_device (GdkWaylandSeat *seat, { seat->wheel_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Wayland Wheel Scrolling", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_MOUSE, "has-cursor", TRUE, "display", seat->display, @@ -3100,7 +3093,6 @@ get_scroll_device (GdkWaylandSeat *seat, { seat->finger_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Wayland Finger Scrolling", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_TOUCHPAD, "has-cursor", TRUE, "display", seat->display, @@ -3115,7 +3107,6 @@ get_scroll_device (GdkWaylandSeat *seat, { seat->continuous_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Wayland Continuous Scrolling", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_TRACKPOINT, "has-cursor", TRUE, "display", seat->display, @@ -4098,7 +4089,6 @@ tablet_pad_handle_done (void *data, pad->device = g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD, "name", "Pad device", - "type", GDK_DEVICE_TYPE_PHYSICAL, "source", GDK_SOURCE_TABLET_PAD, "display", gdk_seat_get_display (pad->seat), "seat", pad->seat, @@ -4276,7 +4266,6 @@ init_devices (GdkWaylandSeat *seat) /* pointer */ seat->logical_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Core Pointer", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_MOUSE, "has-cursor", TRUE, "display", seat->display, @@ -4288,7 +4277,6 @@ init_devices (GdkWaylandSeat *seat) /* keyboard */ seat->logical_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE, "name", "Core Keyboard", - "type", GDK_DEVICE_TYPE_LOGICAL, "source", GDK_SOURCE_KEYBOARD, "has-cursor", FALSE, "display", seat->display, diff --git a/gdk/win32/gdkdevicemanager-win32.c b/gdk/win32/gdkdevicemanager-win32.c index 5ca900b850..1f3f2d87db 100644 --- a/gdk/win32/gdkdevicemanager-win32.c +++ b/gdk/win32/gdkdevicemanager-win32.c @@ -74,13 +74,12 @@ static GdkDevice * create_pointer (GdkDeviceManagerWin32 *device_manager, GType g_type, const char *name, - GdkDeviceType type) + gboolean has_cursor) { return g_object_new (g_type, "name", name, - "type", type, "source", GDK_SOURCE_MOUSE, - "has-cursor", type == GDK_DEVICE_TYPE_LOGICAL, + "has-cursor", has_cursor, "display", _gdk_display, NULL); } @@ -88,12 +87,10 @@ create_pointer (GdkDeviceManagerWin32 *device_manager, static GdkDevice * create_keyboard (GdkDeviceManagerWin32 *device_manager, GType g_type, - const char *name, - GdkDeviceType type) + const char *name) { return g_object_new (g_type, "name", name, - "type", type, "source", GDK_SOURCE_KEYBOARD, "has-cursor", FALSE, "display", _gdk_display, @@ -555,7 +552,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager) device = g_object_new (GDK_TYPE_DEVICE_WINTAB, "name", device_name, - "type", GDK_DEVICE_TYPE_FLOATING, "source", GDK_SOURCE_PEN, "has-cursor", lc.lcOptions & CXO_SYSTEM, "display", display, @@ -693,12 +689,12 @@ gdk_device_manager_win32_constructed (GObject *object) create_pointer (device_manager, GDK_TYPE_DEVICE_VIRTUAL, "Virtual Core Pointer", - GDK_DEVICE_TYPE_LOGICAL); + TRUE); device_manager->system_pointer = create_pointer (device_manager, GDK_TYPE_DEVICE_WIN32, "System Aggregated Pointer", - GDK_DEVICE_TYPE_PHYSICAL); + FALSE); _gdk_device_virtual_set_active (device_manager->core_pointer, device_manager->system_pointer); _gdk_device_set_associated_device (device_manager->system_pointer, device_manager->core_pointer); @@ -707,13 +703,11 @@ gdk_device_manager_win32_constructed (GObject *object) device_manager->core_keyboard = create_keyboard (device_manager, GDK_TYPE_DEVICE_VIRTUAL, - "Virtual Core Keyboard", - GDK_DEVICE_TYPE_LOGICAL); + "Virtual Core Keyboard"); device_manager->system_keyboard = create_keyboard (device_manager, GDK_TYPE_DEVICE_WIN32, - "System Aggregated Keyboard", - GDK_DEVICE_TYPE_PHYSICAL); + "System Aggregated Keyboard"); _gdk_device_virtual_set_active (device_manager->core_keyboard, device_manager->system_keyboard); _gdk_device_set_associated_device (device_manager->system_keyboard, device_manager->core_keyboard); |