forked from AuroraMiddleware/gtk
Rename master and slave device
We already use the "logical/virtual" and "physical" names in the documentation, there's no reason to use loaded terms just because X11 uses them.
This commit is contained in:
parent
c7916c8e48
commit
1c856a208f
@ -359,7 +359,7 @@ gdk_device_get_product_id
|
||||
gdk_device_get_source
|
||||
gdk_device_get_axis_use
|
||||
gdk_device_get_associated_device
|
||||
gdk_device_list_slave_devices
|
||||
gdk_device_list_physical_devices
|
||||
gdk_device_get_device_type
|
||||
gdk_device_get_display
|
||||
gdk_device_get_has_cursor
|
||||
@ -442,8 +442,8 @@ gdk_seat_get_display
|
||||
gdk_seat_get_capabilities
|
||||
gdk_seat_get_pointer
|
||||
gdk_seat_get_keyboard
|
||||
gdk_seat_get_slaves
|
||||
gdk_seat_get_master_pointers
|
||||
gdk_seat_get_physical_devices
|
||||
gdk_seat_get_logical_pointers
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_SEAT
|
||||
|
@ -5,7 +5,7 @@ in what happens to translate a key press or mouse motion of the users into a
|
||||
change of a GTK widget, you should read this chapter. This knowledge will also
|
||||
be useful if you decide to implement your own widgets.
|
||||
|
||||
Devices and events
|
||||
## Devices and events
|
||||
|
||||
The most basic input devices that every computer user has interacted with are
|
||||
keyboards and mice; beyond these, GTK supports touchpads, touchscreens and
|
||||
@ -13,14 +13,14 @@ more exotic input devices such as graphics tablets. Inside GTK, every such
|
||||
input device is represented by a #GdkDevice object.
|
||||
|
||||
To simplify dealing with the variability between these input devices, GTK
|
||||
has a concept of master and slave devices. The concrete physical devices that
|
||||
has a concept of logical and physical devices. The concrete physical devices that
|
||||
have many different characteristics (mice may have 2 or 3 or 8 buttons,
|
||||
keyboards have different layouts and may or may not have a separate number
|
||||
block, etc) are represented as slave devices. Each slave device is
|
||||
associated with a virtual master device. Master devices always come in
|
||||
block, etc) are represented as physical devices. Each physical device is
|
||||
associated with a virtual logical device. Logical devices always come in
|
||||
pointer/keyboard pairs - you can think of such a pair as a 'seat'.
|
||||
|
||||
GTK widgets generally deal with the master devices, and thus can be used
|
||||
GTK widgets generally deal with the logical devices, and thus can be used
|
||||
with any pointing device or keyboard.
|
||||
|
||||
When a user interacts with an input device (e.g. moves a mouse or presses
|
||||
|
@ -157,7 +157,7 @@ _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
|
||||
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
|
||||
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
|
||||
|
||||
|
@ -119,7 +119,7 @@ create_core_pointer (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Core Pointer",
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"source", GDK_SOURCE_MOUSE,
|
||||
"has-cursor", TRUE,
|
||||
"display", display,
|
||||
@ -131,7 +131,7 @@ create_core_keyboard (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Core Keyboard",
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"source", GDK_SOURCE_KEYBOARD,
|
||||
"has-cursor", FALSE,
|
||||
"display", display,
|
||||
@ -143,7 +143,7 @@ create_pointer (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Pointer",
|
||||
"type", GDK_DEVICE_TYPE_SLAVE,
|
||||
"type", GDK_DEVICE_TYPE_PHYSICAL,
|
||||
"source", GDK_SOURCE_MOUSE,
|
||||
"has-cursor", TRUE,
|
||||
"display", display,
|
||||
@ -155,7 +155,7 @@ create_keyboard (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Keyboard",
|
||||
"type", GDK_DEVICE_TYPE_SLAVE,
|
||||
"type", GDK_DEVICE_TYPE_PHYSICAL,
|
||||
"source", GDK_SOURCE_KEYBOARD,
|
||||
"has-cursor", FALSE,
|
||||
"display", display,
|
||||
@ -167,7 +167,7 @@ create_touchscreen (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Touchscreen",
|
||||
"type", GDK_DEVICE_TYPE_SLAVE,
|
||||
"type", GDK_DEVICE_TYPE_PHYSICAL,
|
||||
"source", GDK_SOURCE_TOUCHSCREEN,
|
||||
"has-cursor", FALSE,
|
||||
"display", display,
|
||||
@ -196,15 +196,15 @@ _gdk_broadway_display_open (const gchar *display_name)
|
||||
_gdk_device_set_associated_device (broadway_display->pointer, broadway_display->core_pointer);
|
||||
_gdk_device_set_associated_device (broadway_display->keyboard, broadway_display->core_keyboard);
|
||||
_gdk_device_set_associated_device (broadway_display->touchscreen, broadway_display->core_pointer);
|
||||
_gdk_device_add_slave (broadway_display->core_pointer, broadway_display->touchscreen);
|
||||
_gdk_device_add_physical_device (broadway_display->core_pointer, broadway_display->touchscreen);
|
||||
|
||||
seat = gdk_seat_default_new_for_master_pair (broadway_display->core_pointer,
|
||||
broadway_display->core_keyboard);
|
||||
seat = gdk_seat_default_new_for_logical_pair (broadway_display->core_pointer,
|
||||
broadway_display->core_keyboard);
|
||||
|
||||
gdk_display_add_seat (display, seat);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->pointer);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->keyboard);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->touchscreen);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), broadway_display->pointer);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), broadway_display->keyboard);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), broadway_display->touchscreen);
|
||||
g_object_unref (seat);
|
||||
|
||||
gdk_event_init (display);
|
||||
|
128
gdk/gdkdevice.c
128
gdk/gdkdevice.c
@ -36,7 +36,7 @@
|
||||
* as a keyboard, a mouse, a touchpad, etc.
|
||||
*
|
||||
* See the #GdkSeat documentation for more information
|
||||
* about the various kinds of master and slave devices, and their
|
||||
* about the various kinds of logical and physical devices, and their
|
||||
* relationships.
|
||||
*/
|
||||
|
||||
@ -152,15 +152,16 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
P_("Device type"),
|
||||
P_("Device role in the device manager"),
|
||||
GDK_TYPE_DEVICE_TYPE,
|
||||
GDK_DEVICE_TYPE_MASTER,
|
||||
GDK_DEVICE_TYPE_LOGICAL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDevice:associated-device:
|
||||
*
|
||||
* Associated pointer or keyboard with this device, if any. Devices of type #GDK_DEVICE_TYPE_MASTER
|
||||
* always come in keyboard/pointer pairs. Other device types will have a %NULL associated device.
|
||||
* Associated pointer or keyboard with this device, if any. Devices of
|
||||
* type #GDK_DEVICE_TYPE_LOGICAL always come in keyboard/pointer pairs.
|
||||
* Other device types will have a %NULL associated device.
|
||||
*/
|
||||
device_props[PROP_ASSOCIATED_DEVICE] =
|
||||
g_param_spec_object ("associated-device",
|
||||
@ -187,7 +188,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_MASTER will have %TRUE here.
|
||||
* %GDK_DEVICE_TYPE_LOGICAL will have %TRUE here.
|
||||
*/
|
||||
device_props[PROP_HAS_CURSOR] =
|
||||
g_param_spec_boolean ("has-cursor",
|
||||
@ -333,11 +334,11 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
*
|
||||
* The ::changed signal is emitted either when the #GdkDevice
|
||||
* has changed the number of either axes or keys. For example
|
||||
* In X this will normally happen when the slave device routing
|
||||
* events through the master device changes (for example, user
|
||||
* switches from the USB mouse to a tablet), in that case the
|
||||
* master device will change to reflect the new slave device
|
||||
* axes and keys.
|
||||
* on X11 this will normally happen when the physical device
|
||||
* routing events through the logical device changes (for
|
||||
* example, user switches from the USB mouse to a tablet); in
|
||||
* that case the logical device will change to reflect the axes
|
||||
* and keys on the new physical device.
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("changed"),
|
||||
@ -394,14 +395,14 @@ gdk_device_dispose (GObject *object)
|
||||
GdkDevice *device = GDK_DEVICE (object);
|
||||
GdkDevice *associated = device->associated;
|
||||
|
||||
if (associated && device->type == GDK_DEVICE_TYPE_SLAVE)
|
||||
_gdk_device_remove_slave (associated, device);
|
||||
if (associated && device->type == GDK_DEVICE_TYPE_PHYSICAL)
|
||||
_gdk_device_remove_physical_device (associated, device);
|
||||
|
||||
if (associated)
|
||||
{
|
||||
device->associated = NULL;
|
||||
|
||||
if (device->type == GDK_DEVICE_TYPE_MASTER &&
|
||||
if (device->type == GDK_DEVICE_TYPE_LOGICAL &&
|
||||
associated->associated == device)
|
||||
_gdk_device_set_associated_device (associated, NULL);
|
||||
|
||||
@ -539,21 +540,23 @@ gdk_device_get_property (GObject *object,
|
||||
* the axes of @device in, or %NULL.
|
||||
* @mask: (optional) (out): location to store the modifiers, or %NULL.
|
||||
*
|
||||
* Gets the current state of a pointer device relative to @surface. As a slave
|
||||
* device’s coordinates are those of its master pointer, this
|
||||
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
||||
* unless there is an ongoing grab on them. See gdk_seat_grab().
|
||||
* Gets the current state of a pointer device relative to @surface. As a
|
||||
* physical device’s 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 also: gdk_seat_grab().
|
||||
*/
|
||||
void
|
||||
gdk_device_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *surface,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
|
||||
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));
|
||||
|
||||
if (GDK_DEVICE_GET_CLASS (device)->get_state)
|
||||
@ -575,7 +578,7 @@ 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_SLAVE ||
|
||||
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);
|
||||
@ -593,8 +596,8 @@ 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 slave device coordinates are those of its master pointer, This
|
||||
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
||||
* 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
|
||||
@ -610,7 +613,7 @@ 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_SLAVE ||
|
||||
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);
|
||||
@ -717,15 +720,14 @@ gdk_device_get_display (GdkDevice *device)
|
||||
* gdk_device_get_associated_device:
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* Returns the associated device to @device, if @device is of type
|
||||
* %GDK_DEVICE_TYPE_MASTER, it will return the paired pointer or
|
||||
* keyboard.
|
||||
* Returns the #GdkDevice associated to @device:
|
||||
*
|
||||
* If @device is of type %GDK_DEVICE_TYPE_SLAVE, it will return
|
||||
* the master device to which @device is attached to.
|
||||
*
|
||||
* If @device is of type %GDK_DEVICE_TYPE_FLOATING, %NULL will be
|
||||
* returned, as there is no associated device.
|
||||
* - if @device is of type %GDK_DEVICE_TYPE_LOGICAL, it will return
|
||||
* the paired pointer or keyboard.
|
||||
* - if @device is of type %GDK_DEVICE_TYPE_PHYSICAL, it will return
|
||||
* the logical device to which @device is attached to.
|
||||
* - if @device is of type %GDK_DEVICE_TYPE_FLOATING, %NULL will be
|
||||
* returned, as there is no associated device.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): The associated device, or
|
||||
* %NULL
|
||||
@ -769,63 +771,59 @@ _gdk_device_set_associated_device (GdkDevice *device,
|
||||
if (associated)
|
||||
device->associated = g_object_ref (associated);
|
||||
|
||||
if (device->type != GDK_DEVICE_TYPE_MASTER)
|
||||
if (device->type != GDK_DEVICE_TYPE_LOGICAL)
|
||||
{
|
||||
if (device->associated)
|
||||
_gdk_device_set_device_type (device, GDK_DEVICE_TYPE_SLAVE);
|
||||
_gdk_device_set_device_type (device, GDK_DEVICE_TYPE_PHYSICAL);
|
||||
else
|
||||
_gdk_device_set_device_type (device, GDK_DEVICE_TYPE_FLOATING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_list_slave_devices:
|
||||
* @device: a #GdkDevice
|
||||
* gdk_device_list_physical_devices:
|
||||
* @device: a logical #GdkDevice
|
||||
*
|
||||
* If the device if of type %GDK_DEVICE_TYPE_MASTER, it will return
|
||||
* the list of slave devices attached to it, otherwise it will return
|
||||
* %NULL
|
||||
* Returns the list of physical devices attached to the given logical
|
||||
* #GdkDevice.
|
||||
*
|
||||
* Returns: (nullable) (transfer container) (element-type GdkDevice):
|
||||
* the list of slave devices, or %NULL. The list must be
|
||||
* freed with g_list_free(), the contents of the list are
|
||||
* owned by GTK+ and should not be freed.
|
||||
**/
|
||||
* the list of physical devices attached to a logical #GdkDevice
|
||||
*/
|
||||
GList *
|
||||
gdk_device_list_slave_devices (GdkDevice *device)
|
||||
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_MASTER, NULL);
|
||||
g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL, NULL);
|
||||
|
||||
return g_list_copy (device->slaves);
|
||||
return g_list_copy (device->physical_devices);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_device_add_slave (GdkDevice *device,
|
||||
GdkDevice *slave)
|
||||
_gdk_device_add_physical_device (GdkDevice *device,
|
||||
GdkDevice *physical)
|
||||
{
|
||||
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
|
||||
g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
|
||||
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->slaves, slave))
|
||||
device->slaves = g_list_prepend (device->slaves, slave);
|
||||
if (!g_list_find (device->physical_devices, physical))
|
||||
device->physical_devices = g_list_prepend (device->physical_devices, physical);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_device_remove_slave (GdkDevice *device,
|
||||
GdkDevice *slave)
|
||||
_gdk_device_remove_physical_device (GdkDevice *device,
|
||||
GdkDevice *physical)
|
||||
{
|
||||
GList *elem;
|
||||
|
||||
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
|
||||
g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
|
||||
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->slaves, slave);
|
||||
|
||||
if (!elem)
|
||||
elem = g_list_find (device->physical_devices, physical);
|
||||
if (elem == NULL)
|
||||
return;
|
||||
|
||||
device->slaves = g_list_delete_link (device->slaves, elem);
|
||||
device->physical_devices = g_list_delete_link (device->physical_devices, elem);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -839,7 +837,7 @@ _gdk_device_remove_slave (GdkDevice *device,
|
||||
GdkDeviceType
|
||||
gdk_device_get_device_type (GdkDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_MASTER);
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_LOGICAL);
|
||||
|
||||
return device->type;
|
||||
}
|
||||
@ -1315,7 +1313,7 @@ gdk_device_get_last_event_surface (GdkDevice *device)
|
||||
|
||||
/**
|
||||
* gdk_device_get_vendor_id:
|
||||
* @device: a slave #GdkDevice
|
||||
* @device: a physical #GdkDevice
|
||||
*
|
||||
* Returns the vendor ID of this device, or %NULL if this information couldn't
|
||||
* be obtained. This ID is retrieved from the device, and is thus constant for
|
||||
@ -1350,14 +1348,14 @@ const gchar *
|
||||
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_MASTER, NULL);
|
||||
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL);
|
||||
|
||||
return device->vendor_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_product_id:
|
||||
* @device: a slave #GdkDevice
|
||||
* @device: a physical #GdkDevice
|
||||
*
|
||||
* Returns the product ID of this device, or %NULL if this information couldn't
|
||||
* be obtained. This ID is retrieved from the device, and is thus constant for
|
||||
@ -1369,7 +1367,7 @@ const gchar *
|
||||
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_MASTER, NULL);
|
||||
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL);
|
||||
|
||||
return device->product_id;
|
||||
}
|
||||
@ -1424,7 +1422,7 @@ 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_MASTER);
|
||||
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL);
|
||||
|
||||
if (g_set_object (&device->last_tool, tool))
|
||||
{
|
||||
|
@ -71,17 +71,17 @@ typedef enum
|
||||
|
||||
/**
|
||||
* GdkDeviceType:
|
||||
* @GDK_DEVICE_TYPE_MASTER: Device is a master (or virtual) device. There will
|
||||
* be an associated focus indicator on the screen.
|
||||
* @GDK_DEVICE_TYPE_SLAVE: Device is a slave (or physical) device.
|
||||
* @GDK_DEVICE_TYPE_FLOATING: Device is a physical device, currently not attached to
|
||||
* any seat.
|
||||
* @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_MASTER,
|
||||
GDK_DEVICE_TYPE_SLAVE,
|
||||
GDK_DEVICE_TYPE_LOGICAL,
|
||||
GDK_DEVICE_TYPE_PHYSICAL,
|
||||
GDK_DEVICE_TYPE_FLOATING
|
||||
} GdkDeviceType;
|
||||
|
||||
@ -141,7 +141,7 @@ GdkDisplay * gdk_device_get_display (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_device_get_associated_device (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_device_list_slave_devices (GdkDevice *device);
|
||||
GList * gdk_device_list_physical_devices (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
|
||||
|
@ -41,11 +41,11 @@ struct _GdkDevice
|
||||
gboolean has_cursor;
|
||||
GdkAxisFlags axis_flags;
|
||||
GdkDisplay *display;
|
||||
/* Paired master for master,
|
||||
* associated master for slaves
|
||||
/* The paired logical device for logical devices,
|
||||
* or the associated logical device for physical ones
|
||||
*/
|
||||
GdkDevice *associated;
|
||||
GList *slaves;
|
||||
GList *physical_devices;
|
||||
GdkDeviceType type;
|
||||
GArray *axes;
|
||||
guint num_touches;
|
||||
@ -132,10 +132,11 @@ gboolean _gdk_device_translate_axis (GdkDevice *device,
|
||||
GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
|
||||
gint n_events);
|
||||
|
||||
void _gdk_device_add_slave (GdkDevice *device,
|
||||
GdkDevice *slave);
|
||||
void _gdk_device_remove_slave (GdkDevice *device,
|
||||
GdkDevice *slave);
|
||||
void _gdk_device_add_physical_device (GdkDevice *device,
|
||||
GdkDevice *physical);
|
||||
void _gdk_device_remove_physical_device (GdkDevice *device,
|
||||
GdkDevice *physical);
|
||||
|
||||
void _gdk_device_query_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkSurface **child_surface,
|
||||
|
@ -643,12 +643,12 @@ switch_to_pointer_grab (GdkDisplay *display,
|
||||
if (grab == NULL /* ungrab */ ||
|
||||
(!last_grab->owner_events && grab->owner_events) /* switched to owner_events */ )
|
||||
{
|
||||
/* Ungrabbed slave devices don't have a position by
|
||||
* itself, rather depend on its master pointer, so
|
||||
/* 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_SLAVE)
|
||||
if (grab || gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL)
|
||||
new_toplevel = get_current_toplevel (display, device, &x, &y, &state);
|
||||
|
||||
if (new_toplevel)
|
||||
|
@ -66,7 +66,7 @@ typedef struct
|
||||
gdouble toplevel_x, toplevel_y;
|
||||
guint32 state;
|
||||
guint32 button;
|
||||
GdkDevice *last_slave;
|
||||
GdkDevice *last_physical_device;
|
||||
} GdkPointerSurfaceInfo;
|
||||
|
||||
struct _GdkDisplay
|
||||
|
@ -1205,9 +1205,9 @@ gdk_event_get_device (GdkEvent *event)
|
||||
* gdk_event_get_source_device:
|
||||
* @event: a #GdkEvent
|
||||
*
|
||||
* This function returns the hardware (slave) #GdkDevice that has
|
||||
* triggered the event, falling back to the virtual (master) device
|
||||
* (as in gdk_event_get_device()) if the event wasn’t caused by
|
||||
* This function returns the physical #GdkDevice that has triggered
|
||||
* the event, falling back to the logical device, as returned by
|
||||
* gdk_event_get_device(), if the event wasn’t caused by
|
||||
* interaction with a hardware device. This may happen for example
|
||||
* in synthesized crossing events after a #GdkSurface updates its
|
||||
* geometry or a grab is acquired/released.
|
||||
|
@ -323,35 +323,35 @@ gdk_seat_ungrab (GdkSeat *seat)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_seat_get_slaves:
|
||||
* gdk_seat_get_physical_devices:
|
||||
* @seat: a #GdkSeat
|
||||
* @capabilities: capabilities to get devices for
|
||||
*
|
||||
* Returns the slave devices that match the given capabilities.
|
||||
* Returns the physical devices that match the given capabilities.
|
||||
*
|
||||
* Returns: (transfer container) (element-type GdkDevice): A list of #GdkDevices.
|
||||
* The list must be freed with g_list_free(), the elements are owned
|
||||
* by GDK and must not be freed.
|
||||
**/
|
||||
GList *
|
||||
gdk_seat_get_slaves (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities)
|
||||
gdk_seat_get_physical_devices (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities)
|
||||
{
|
||||
GdkSeatClass *seat_class;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
||||
|
||||
seat_class = GDK_SEAT_GET_CLASS (seat);
|
||||
return seat_class->get_slaves (seat, capabilities);
|
||||
return seat_class->get_physical_devices (seat, capabilities);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_seat_get_pointer:
|
||||
* @seat: a #GdkSeat
|
||||
*
|
||||
* Returns the master device that routes pointer events.
|
||||
* Returns the logical device that routes pointer events.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a master #GdkDevice with pointer
|
||||
* Returns: (transfer none) (nullable): a logical #GdkDevice with pointer
|
||||
* capabilities. This object is owned by GTK and must not be freed.
|
||||
**/
|
||||
GdkDevice *
|
||||
@ -362,16 +362,16 @@ gdk_seat_get_pointer (GdkSeat *seat)
|
||||
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
||||
|
||||
seat_class = GDK_SEAT_GET_CLASS (seat);
|
||||
return seat_class->get_master (seat, GDK_SEAT_CAPABILITY_POINTER);
|
||||
return seat_class->get_logical_device (seat, GDK_SEAT_CAPABILITY_POINTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_seat_get_keyboard:
|
||||
* @seat: a #GdkSeat
|
||||
*
|
||||
* Returns the master device that routes keyboard events.
|
||||
* Returns the logical device that routes keyboard events.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a master #GdkDevice with keyboard
|
||||
* Returns: (transfer none) (nullable): a logical #GdkDevice with keyboard
|
||||
* capabilities. This object is owned by GTK and must not be freed.
|
||||
**/
|
||||
GdkDevice *
|
||||
@ -382,7 +382,7 @@ gdk_seat_get_keyboard (GdkSeat *seat)
|
||||
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
||||
|
||||
seat_class = GDK_SEAT_GET_CLASS (seat);
|
||||
return seat_class->get_master (seat, GDK_SEAT_CAPABILITY_KEYBOARD);
|
||||
return seat_class->get_logical_device (seat, GDK_SEAT_CAPABILITY_KEYBOARD);
|
||||
}
|
||||
|
||||
void
|
||||
@ -448,25 +448,29 @@ gdk_seat_get_tool (GdkSeat *seat,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_seat_get_master_pointers:
|
||||
* gdk_seat_get_logical_pointers:
|
||||
* @seat: The #GdkSeat
|
||||
* @capabilities: Queried capabilities
|
||||
*
|
||||
* Returns all master pointers with the given capabilities driven by this @seat.
|
||||
* On most backends this function will return a list with a single element (meaning
|
||||
* that all input devices drive the same onscreen cursor).
|
||||
* Returns all logical pointers with the given capabilities driven by
|
||||
* this @seat.
|
||||
*
|
||||
* In other backends where there can possibly be multiple foci (eg. wayland),
|
||||
* this function will return all master #GdkDevices that represent these.
|
||||
* On most windowing system backends this function will return a list
|
||||
* with a single element (meaning that all input devices drive the same
|
||||
* on-screen cursor).
|
||||
*
|
||||
* In other windowing systems where there can possibly be multiple
|
||||
* foci (e.g. Wayland), this function will return all logical #GdkDevices
|
||||
* that represent these.
|
||||
*
|
||||
* Returns: (transfer container) (element-type GdkDevice): A list
|
||||
* of master pointing devices
|
||||
* of logical pointing devices
|
||||
*/
|
||||
GList *
|
||||
gdk_seat_get_master_pointers (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities)
|
||||
gdk_seat_get_logical_pointers (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
||||
|
||||
return GDK_SEAT_GET_CLASS (seat)->get_master_pointers (seat, capabilities);
|
||||
return GDK_SEAT_GET_CLASS (seat)->get_logical_pointers (seat, capabilities);
|
||||
}
|
||||
|
@ -68,24 +68,24 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_seat_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_seat_get_display (GdkSeat *seat);
|
||||
GdkDisplay * gdk_seat_get_display (GdkSeat *seat);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSeatCapabilities
|
||||
gdk_seat_get_capabilities (GdkSeat *seat);
|
||||
gdk_seat_get_capabilities (GdkSeat *seat);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_seat_get_slaves (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
GList * gdk_seat_get_physical_devices (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_seat_get_pointer (GdkSeat *seat);
|
||||
GdkDevice * gdk_seat_get_pointer (GdkSeat *seat);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_seat_get_keyboard (GdkSeat *seat);
|
||||
GdkDevice * gdk_seat_get_keyboard (GdkSeat *seat);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_seat_get_master_pointers (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
GList * gdk_seat_get_logical_pointers (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -25,10 +25,10 @@ typedef struct _GdkSeatDefaultPrivate GdkSeatDefaultPrivate;
|
||||
|
||||
struct _GdkSeatDefaultPrivate
|
||||
{
|
||||
GdkDevice *master_pointer;
|
||||
GdkDevice *master_keyboard;
|
||||
GList *slave_pointers;
|
||||
GList *slave_keyboards;
|
||||
GdkDevice *logical_pointer;
|
||||
GdkDevice *logical_keyboard;
|
||||
GList *physical_pointers;
|
||||
GList *physical_keyboards;
|
||||
GdkSeatCapabilities capabilities;
|
||||
|
||||
GPtrArray *tools;
|
||||
@ -55,25 +55,25 @@ gdk_seat_dispose (GObject *object)
|
||||
GdkSeatDefaultPrivate *priv = gdk_seat_default_get_instance_private (seat);
|
||||
GList *l;
|
||||
|
||||
if (priv->master_pointer)
|
||||
if (priv->logical_pointer)
|
||||
{
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), priv->master_pointer);
|
||||
g_clear_object (&priv->master_pointer);
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), priv->logical_pointer);
|
||||
g_clear_object (&priv->logical_pointer);
|
||||
}
|
||||
|
||||
if (priv->master_keyboard)
|
||||
if (priv->logical_keyboard)
|
||||
{
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), priv->master_keyboard);
|
||||
g_clear_object (&priv->master_pointer);
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), priv->logical_keyboard);
|
||||
g_clear_object (&priv->logical_pointer);
|
||||
}
|
||||
|
||||
for (l = priv->slave_pointers; l; l = l->next)
|
||||
for (l = priv->physical_pointers; l; l = l->next)
|
||||
{
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), l->data);
|
||||
g_object_unref (l->data);
|
||||
}
|
||||
|
||||
for (l = priv->slave_keyboards; l; l = l->next)
|
||||
for (l = priv->physical_keyboards; l; l = l->next)
|
||||
{
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), l->data);
|
||||
g_object_unref (l->data);
|
||||
@ -85,10 +85,10 @@ gdk_seat_dispose (GObject *object)
|
||||
priv->tools = NULL;
|
||||
}
|
||||
|
||||
g_list_free (priv->slave_pointers);
|
||||
g_list_free (priv->slave_keyboards);
|
||||
priv->slave_pointers = NULL;
|
||||
priv->slave_keyboards = NULL;
|
||||
g_list_free (priv->physical_pointers);
|
||||
g_list_free (priv->physical_keyboards);
|
||||
priv->physical_pointers = NULL;
|
||||
priv->physical_keyboards = NULL;
|
||||
|
||||
G_OBJECT_CLASS (gdk_seat_default_parent_class)->dispose (object);
|
||||
}
|
||||
@ -148,7 +148,7 @@ gdk_seat_default_grab (GdkSeat *seat,
|
||||
if (capabilities & GDK_SEAT_CAPABILITY_TOUCH)
|
||||
pointer_evmask |= TOUCH_EVENTS;
|
||||
|
||||
status = gdk_device_grab (priv->master_pointer, surface,
|
||||
status = gdk_device_grab (priv->logical_pointer, surface,
|
||||
GDK_OWNERSHIP_NONE, owner_events,
|
||||
pointer_evmask, cursor,
|
||||
evtime);
|
||||
@ -157,7 +157,7 @@ gdk_seat_default_grab (GdkSeat *seat,
|
||||
if (status == GDK_GRAB_SUCCESS &&
|
||||
capabilities & GDK_SEAT_CAPABILITY_KEYBOARD)
|
||||
{
|
||||
status = gdk_device_grab (priv->master_keyboard, surface,
|
||||
status = gdk_device_grab (priv->logical_keyboard, surface,
|
||||
GDK_OWNERSHIP_NONE, owner_events,
|
||||
KEYBOARD_EVENTS, cursor,
|
||||
evtime);
|
||||
@ -165,7 +165,7 @@ gdk_seat_default_grab (GdkSeat *seat,
|
||||
if (status != GDK_GRAB_SUCCESS)
|
||||
{
|
||||
if (capabilities & ~GDK_SEAT_CAPABILITY_KEYBOARD)
|
||||
gdk_device_ungrab (priv->master_pointer, evtime);
|
||||
gdk_device_ungrab (priv->logical_pointer, evtime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,14 +185,14 @@ gdk_seat_default_ungrab (GdkSeat *seat)
|
||||
priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
gdk_device_ungrab (priv->master_pointer, GDK_CURRENT_TIME);
|
||||
gdk_device_ungrab (priv->master_keyboard, GDK_CURRENT_TIME);
|
||||
gdk_device_ungrab (priv->logical_pointer, GDK_CURRENT_TIME);
|
||||
gdk_device_ungrab (priv->logical_keyboard, GDK_CURRENT_TIME);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
gdk_seat_default_get_master (GdkSeat *seat,
|
||||
GdkSeatCapabilities capability)
|
||||
gdk_seat_default_get_logical_device (GdkSeat *seat,
|
||||
GdkSeatCapabilities capability)
|
||||
{
|
||||
GdkSeatDefaultPrivate *priv;
|
||||
|
||||
@ -203,9 +203,9 @@ gdk_seat_default_get_master (GdkSeat *seat,
|
||||
{
|
||||
case GDK_SEAT_CAPABILITY_POINTER:
|
||||
case GDK_SEAT_CAPABILITY_TOUCH:
|
||||
return priv->master_pointer;
|
||||
return priv->logical_pointer;
|
||||
case GDK_SEAT_CAPABILITY_KEYBOARD:
|
||||
return priv->master_keyboard;
|
||||
return priv->logical_keyboard;
|
||||
default:
|
||||
g_warning ("Unhandled capability %x", capability);
|
||||
break;
|
||||
@ -264,8 +264,8 @@ append_filtered (GList *list,
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_seat_default_get_slaves (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities)
|
||||
gdk_seat_default_get_physical_devices (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities)
|
||||
{
|
||||
GdkSeatDefaultPrivate *priv;
|
||||
GList *devices = NULL;
|
||||
@ -273,10 +273,10 @@ gdk_seat_default_get_slaves (GdkSeat *seat,
|
||||
priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat));
|
||||
|
||||
if (capabilities & (GDK_SEAT_CAPABILITY_ALL_POINTING))
|
||||
devices = append_filtered (devices, priv->slave_pointers, capabilities);
|
||||
devices = append_filtered (devices, priv->physical_pointers, capabilities);
|
||||
|
||||
if (capabilities & (GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_TABLET_PAD))
|
||||
devices = append_filtered (devices, priv->slave_keyboards, capabilities);
|
||||
devices = append_filtered (devices, priv->physical_keyboards, capabilities);
|
||||
|
||||
return devices;
|
||||
}
|
||||
@ -307,15 +307,15 @@ gdk_seat_default_get_tool (GdkSeat *seat,
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_seat_default_get_master_pointers (GdkSeat *seat,
|
||||
gdk_seat_default_get_logical_pointers (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities)
|
||||
{
|
||||
GList *masters = NULL;
|
||||
GList *pointers = NULL;
|
||||
|
||||
if (capabilities & GDK_SEAT_CAPABILITY_ALL_POINTING)
|
||||
masters = g_list_prepend (masters, gdk_seat_get_pointer (seat));
|
||||
pointers = g_list_prepend (pointers, gdk_seat_get_pointer (seat));
|
||||
|
||||
return masters;
|
||||
return pointers;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -331,9 +331,9 @@ gdk_seat_default_class_init (GdkSeatDefaultClass *klass)
|
||||
seat_class->grab = gdk_seat_default_grab;
|
||||
seat_class->ungrab = gdk_seat_default_ungrab;
|
||||
|
||||
seat_class->get_master = gdk_seat_default_get_master;
|
||||
seat_class->get_slaves = gdk_seat_default_get_slaves;
|
||||
seat_class->get_master_pointers = gdk_seat_default_get_master_pointers;
|
||||
seat_class->get_logical_device = gdk_seat_default_get_logical_device;
|
||||
seat_class->get_physical_devices = gdk_seat_default_get_physical_devices;
|
||||
seat_class->get_logical_pointers = gdk_seat_default_get_logical_pointers;
|
||||
|
||||
seat_class->get_tool = gdk_seat_default_get_tool;
|
||||
}
|
||||
@ -344,8 +344,8 @@ gdk_seat_default_init (GdkSeatDefault *seat)
|
||||
}
|
||||
|
||||
GdkSeat *
|
||||
gdk_seat_default_new_for_master_pair (GdkDevice *pointer,
|
||||
GdkDevice *keyboard)
|
||||
gdk_seat_default_new_for_logical_pair (GdkDevice *pointer,
|
||||
GdkDevice *keyboard)
|
||||
{
|
||||
GdkSeatDefaultPrivate *priv;
|
||||
GdkDisplay *display;
|
||||
@ -358,18 +358,18 @@ gdk_seat_default_new_for_master_pair (GdkDevice *pointer,
|
||||
NULL);
|
||||
|
||||
priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat));
|
||||
priv->master_pointer = g_object_ref (pointer);
|
||||
priv->master_keyboard = g_object_ref (keyboard);
|
||||
priv->logical_pointer = g_object_ref (pointer);
|
||||
priv->logical_keyboard = g_object_ref (keyboard);
|
||||
|
||||
gdk_seat_device_added (seat, priv->master_pointer);
|
||||
gdk_seat_device_added (seat, priv->master_keyboard);
|
||||
gdk_seat_device_added (seat, priv->logical_pointer);
|
||||
gdk_seat_device_added (seat, priv->logical_keyboard);
|
||||
|
||||
return seat;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_seat_default_add_slave (GdkSeatDefault *seat,
|
||||
GdkDevice *device)
|
||||
gdk_seat_default_add_physical_device (GdkSeatDefault *seat,
|
||||
GdkDevice *device)
|
||||
{
|
||||
GdkSeatDefaultPrivate *priv;
|
||||
GdkSeatCapabilities capability;
|
||||
@ -381,9 +381,9 @@ gdk_seat_default_add_slave (GdkSeatDefault *seat,
|
||||
capability = device_get_capability (device);
|
||||
|
||||
if (capability & GDK_SEAT_CAPABILITY_ALL_POINTING)
|
||||
priv->slave_pointers = g_list_prepend (priv->slave_pointers, g_object_ref (device));
|
||||
priv->physical_pointers = g_list_prepend (priv->physical_pointers, g_object_ref (device));
|
||||
else if (capability & (GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_TABLET_PAD))
|
||||
priv->slave_keyboards = g_list_prepend (priv->slave_keyboards, g_object_ref (device));
|
||||
priv->physical_keyboards = g_list_prepend (priv->physical_keyboards, g_object_ref (device));
|
||||
else
|
||||
{
|
||||
g_critical ("Unhandled capability %x for device '%s'",
|
||||
@ -397,8 +397,8 @@ gdk_seat_default_add_slave (GdkSeatDefault *seat,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_seat_default_remove_slave (GdkSeatDefault *seat,
|
||||
GdkDevice *device)
|
||||
gdk_seat_default_remove_physical_device (GdkSeatDefault *seat,
|
||||
GdkDevice *device)
|
||||
{
|
||||
GdkSeatDefaultPrivate *priv;
|
||||
GList *l;
|
||||
@ -408,23 +408,23 @@ gdk_seat_default_remove_slave (GdkSeatDefault *seat,
|
||||
|
||||
priv = gdk_seat_default_get_instance_private (seat);
|
||||
|
||||
if (g_list_find (priv->slave_pointers, device))
|
||||
if (g_list_find (priv->physical_pointers, device))
|
||||
{
|
||||
priv->slave_pointers = g_list_remove (priv->slave_pointers, device);
|
||||
priv->physical_pointers = g_list_remove (priv->physical_pointers, device);
|
||||
|
||||
priv->capabilities &= ~(GDK_SEAT_CAPABILITY_ALL_POINTING);
|
||||
for (l = priv->slave_pointers; l; l = l->next)
|
||||
for (l = priv->physical_pointers; l; l = l->next)
|
||||
priv->capabilities |= device_get_capability (GDK_DEVICE (l->data));
|
||||
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), device);
|
||||
g_object_unref (device);
|
||||
}
|
||||
else if (g_list_find (priv->slave_keyboards, device))
|
||||
else if (g_list_find (priv->physical_keyboards, device))
|
||||
{
|
||||
priv->slave_keyboards = g_list_remove (priv->slave_keyboards, device);
|
||||
priv->physical_keyboards = g_list_remove (priv->physical_keyboards, device);
|
||||
|
||||
priv->capabilities &= ~(GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_TABLET_PAD);
|
||||
for (l = priv->slave_keyboards; l; l = l->next)
|
||||
for (l = priv->physical_keyboards; l; l = l->next)
|
||||
priv->capabilities |= device_get_capability (GDK_DEVICE (l->data));
|
||||
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), device);
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "gdkseat.h"
|
||||
#include "gdkseatprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_SEAT_DEFAULT (gdk_seat_default_get_type ())
|
||||
#define GDK_SEAT_DEFAULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_SEAT_DEFAULT, GdkSeatDefault))
|
||||
#define GDK_IS_SEAT_DEFAULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_SEAT_DEFAULT))
|
||||
@ -45,16 +47,18 @@ struct _GdkSeatDefaultClass
|
||||
|
||||
GType gdk_seat_default_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkSeat * gdk_seat_default_new_for_master_pair (GdkDevice *pointer,
|
||||
GdkDevice *keyboard);
|
||||
GdkSeat * gdk_seat_default_new_for_logical_pair (GdkDevice *pointer,
|
||||
GdkDevice *keyboard);
|
||||
|
||||
void gdk_seat_default_add_slave (GdkSeatDefault *seat,
|
||||
GdkDevice *device);
|
||||
void gdk_seat_default_remove_slave (GdkSeatDefault *seat,
|
||||
GdkDevice *device);
|
||||
void gdk_seat_default_add_tool (GdkSeatDefault *seat,
|
||||
GdkDeviceTool *tool);
|
||||
void gdk_seat_default_remove_tool (GdkSeatDefault *seat,
|
||||
GdkDeviceTool *tool);
|
||||
void gdk_seat_default_add_physical_device (GdkSeatDefault *seat,
|
||||
GdkDevice *device);
|
||||
void gdk_seat_default_remove_physical_device (GdkSeatDefault *seat,
|
||||
GdkDevice *device);
|
||||
void gdk_seat_default_add_tool (GdkSeatDefault *seat,
|
||||
GdkDeviceTool *tool);
|
||||
void gdk_seat_default_remove_tool (GdkSeatDefault *seat,
|
||||
GdkDeviceTool *tool);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_SEAT_DEFAULT_PRIVATE_H__ */
|
||||
|
@ -52,16 +52,16 @@ struct _GdkSeatClass
|
||||
gpointer prepare_func_data);
|
||||
void (* ungrab) (GdkSeat *seat);
|
||||
|
||||
GdkDevice * (* get_master) (GdkSeat *seat,
|
||||
GdkSeatCapabilities capability);
|
||||
GList * (* get_slaves) (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
GdkDevice * (* get_logical_device) (GdkSeat *seat,
|
||||
GdkSeatCapabilities capability);
|
||||
GList * (* get_physical_devices) (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
|
||||
GdkDeviceTool * (* get_tool) (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 tool_id);
|
||||
GList * (* get_master_pointers) (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
GList * (* get_logical_pointers) (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
};
|
||||
|
||||
void gdk_seat_device_added (GdkSeat *seat,
|
||||
|
@ -1762,7 +1762,7 @@ gdk_surface_hide (GdkSurface *surface)
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
if (seat)
|
||||
{
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
|
||||
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
|
||||
}
|
||||
@ -1880,7 +1880,7 @@ gdk_surface_set_cursor (GdkSurface *surface,
|
||||
device = gdk_seat_get_pointer (s->data);
|
||||
gdk_surface_set_cursor_internal (surface, device, surface->cursor);
|
||||
|
||||
devices = gdk_seat_get_slaves (s->data, GDK_SEAT_CAPABILITY_TABLET_STYLUS);
|
||||
devices = gdk_seat_get_physical_devices (s->data, GDK_SEAT_CAPABILITY_TABLET_STYLUS);
|
||||
for (d = devices; d; d = d->next)
|
||||
{
|
||||
device = gdk_device_get_associated_device (d->data);
|
||||
@ -1897,7 +1897,7 @@ gdk_surface_set_cursor (GdkSurface *surface,
|
||||
/**
|
||||
* gdk_surface_get_device_cursor:
|
||||
* @surface: a #GdkSurface.
|
||||
* @device: a master, pointer #GdkDevice.
|
||||
* @device: a logical, pointer #GdkDevice.
|
||||
*
|
||||
* Retrieves a #GdkCursor pointer for the @device currently set on the
|
||||
* specified #GdkSurface, or %NULL. If the return value is %NULL then
|
||||
@ -1916,7 +1916,7 @@ 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_MASTER, 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);
|
||||
}
|
||||
@ -1924,7 +1924,7 @@ gdk_surface_get_device_cursor (GdkSurface *surface,
|
||||
/**
|
||||
* gdk_surface_set_device_cursor:
|
||||
* @surface: a #GdkSurface
|
||||
* @device: a master, pointer #GdkDevice
|
||||
* @device: a logical, pointer #GdkDevice
|
||||
* @cursor: a #GdkCursor
|
||||
*
|
||||
* Sets a specific #GdkCursor for a given device when it gets inside @surface.
|
||||
@ -1942,7 +1942,7 @@ 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_MASTER);
|
||||
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL);
|
||||
|
||||
if (!cursor)
|
||||
g_hash_table_remove (surface->device_cursor, device);
|
||||
@ -2284,11 +2284,11 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
{
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
|
||||
if (source_device != pointer_info->last_slave &&
|
||||
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE)
|
||||
pointer_info->last_slave = source_device;
|
||||
else if (pointer_info->last_slave)
|
||||
source_device = pointer_info->last_slave;
|
||||
if (source_device != pointer_info->last_physical_device &&
|
||||
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_PHYSICAL)
|
||||
pointer_info->last_physical_device = source_device;
|
||||
else if (pointer_info->last_physical_device)
|
||||
source_device = pointer_info->last_physical_device;
|
||||
}
|
||||
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
|
@ -54,7 +54,7 @@ create_core_pointer (GdkQuartzDeviceManagerCore *device_manager,
|
||||
{
|
||||
return g_object_new (GDK_TYPE_QUARTZ_DEVICE_CORE,
|
||||
"name", "Core Pointer",
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"input-source", GDK_SOURCE_MOUSE,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"has-cursor", TRUE,
|
||||
@ -69,7 +69,7 @@ create_core_keyboard (GdkQuartzDeviceManagerCore *device_manager,
|
||||
{
|
||||
return g_object_new (GDK_TYPE_QUARTZ_DEVICE_CORE,
|
||||
"name", "Core Keyboard",
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"input-source", GDK_SOURCE_KEYBOARD,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"has-cursor", FALSE,
|
||||
@ -112,8 +112,8 @@ gdk_quartz_device_manager_core_constructed (GObject *object)
|
||||
_gdk_device_set_associated_device (device_manager->core_pointer, device_manager->core_keyboard);
|
||||
_gdk_device_set_associated_device (device_manager->core_keyboard, device_manager->core_pointer);
|
||||
|
||||
seat = gdk_seat_default_new_for_master_pair (device_manager->core_pointer,
|
||||
device_manager->core_keyboard);
|
||||
seat = gdk_seat_default_new_for_logical_pair (device_manager->core_pointer,
|
||||
device_manager->core_keyboard);
|
||||
gdk_display_add_seat (display, seat);
|
||||
g_object_unref (seat);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -147,7 +147,7 @@ gdk_device_win32_grab (GdkDevice *device,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_)
|
||||
{
|
||||
/* No support for grabbing the slave atm */
|
||||
/* No support for grabbing physical devices atm */
|
||||
return GDK_GRAB_NOT_VIEWABLE;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ create_pointer (GdkDeviceManagerWin32 *device_manager,
|
||||
"name", name,
|
||||
"type", type,
|
||||
"source", GDK_SOURCE_MOUSE,
|
||||
"has-cursor", type == GDK_DEVICE_TYPE_MASTER,
|
||||
"has-cursor", type == GDK_DEVICE_TYPE_LOGICAL,
|
||||
"display", _gdk_display,
|
||||
NULL);
|
||||
}
|
||||
@ -565,7 +565,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
if (device->sends_core)
|
||||
{
|
||||
_gdk_device_set_associated_device (device_manager->system_pointer, GDK_DEVICE (device));
|
||||
_gdk_device_add_slave (device_manager->core_pointer, GDK_DEVICE (device));
|
||||
_gdk_device_add_physical_device (device_manager->core_pointer, GDK_DEVICE (device));
|
||||
}
|
||||
|
||||
g_free (csrname_utf8);
|
||||
@ -693,40 +693,40 @@ gdk_device_manager_win32_constructed (GObject *object)
|
||||
create_pointer (device_manager,
|
||||
GDK_TYPE_DEVICE_VIRTUAL,
|
||||
"Virtual Core Pointer",
|
||||
GDK_DEVICE_TYPE_MASTER);
|
||||
GDK_DEVICE_TYPE_LOGICAL);
|
||||
device_manager->system_pointer =
|
||||
create_pointer (device_manager,
|
||||
GDK_TYPE_DEVICE_WIN32,
|
||||
"System Aggregated Pointer",
|
||||
GDK_DEVICE_TYPE_SLAVE);
|
||||
GDK_DEVICE_TYPE_PHYSICAL);
|
||||
_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);
|
||||
_gdk_device_add_slave (device_manager->core_pointer, device_manager->system_pointer);
|
||||
_gdk_device_add_physical_device (device_manager->core_pointer, device_manager->system_pointer);
|
||||
|
||||
device_manager->core_keyboard =
|
||||
create_keyboard (device_manager,
|
||||
GDK_TYPE_DEVICE_VIRTUAL,
|
||||
"Virtual Core Keyboard",
|
||||
GDK_DEVICE_TYPE_MASTER);
|
||||
GDK_DEVICE_TYPE_LOGICAL);
|
||||
device_manager->system_keyboard =
|
||||
create_keyboard (device_manager,
|
||||
GDK_TYPE_DEVICE_WIN32,
|
||||
"System Aggregated Keyboard",
|
||||
GDK_DEVICE_TYPE_SLAVE);
|
||||
GDK_DEVICE_TYPE_PHYSICAL);
|
||||
_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);
|
||||
_gdk_device_add_slave (device_manager->core_keyboard, device_manager->system_keyboard);
|
||||
_gdk_device_add_physical_device (device_manager->core_keyboard, device_manager->system_keyboard);
|
||||
|
||||
_gdk_device_set_associated_device (device_manager->core_pointer, device_manager->core_keyboard);
|
||||
_gdk_device_set_associated_device (device_manager->core_keyboard, device_manager->core_pointer);
|
||||
|
||||
seat = gdk_seat_default_new_for_master_pair (device_manager->core_pointer,
|
||||
device_manager->core_keyboard);
|
||||
seat = gdk_seat_default_new_for_logical_pair (device_manager->core_pointer,
|
||||
device_manager->core_keyboard);
|
||||
gdk_display_add_seat (_gdk_display, seat);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), device_manager->system_pointer);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), device_manager->system_keyboard);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), device_manager->system_pointer);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), device_manager->system_keyboard);
|
||||
g_object_unref (seat);
|
||||
|
||||
/* Only call Wintab init stuff after the default display
|
||||
|
@ -34,10 +34,10 @@ struct _GdkDeviceManagerWin32
|
||||
{
|
||||
GObject parent_object;
|
||||
GdkDisplay *display;
|
||||
/* Master Devices */
|
||||
/* Logical Devices */
|
||||
GdkDevice *core_pointer;
|
||||
GdkDevice *core_keyboard;
|
||||
/* Fake slave devices */
|
||||
/* Fake physical devices */
|
||||
GdkDevice *system_pointer;
|
||||
GdkDevice *system_keyboard;
|
||||
GList *wintab_devices;
|
||||
|
@ -266,8 +266,8 @@ gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
|
||||
{
|
||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||
|
||||
/* Non-master devices don't have a cursor */
|
||||
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
|
||||
/* Non-logical devices don't have a cursor */
|
||||
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL)
|
||||
return;
|
||||
|
||||
if (cursor)
|
||||
@ -312,12 +312,12 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
|
||||
scale = GDK_X11_SURFACE (surface)->surface_scale;
|
||||
}
|
||||
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_SLAVE)
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL)
|
||||
{
|
||||
GdkDevice *master = gdk_device_get_associated_device (device);
|
||||
GdkDevice *logical = gdk_device_get_associated_device (device);
|
||||
|
||||
if (master)
|
||||
_gdk_device_query_state (master, surface, child_surface,
|
||||
if (logical != NULL)
|
||||
_gdk_device_query_state (logical, surface, child_surface,
|
||||
win_x, win_y, mask);
|
||||
return;
|
||||
}
|
||||
|
@ -518,11 +518,11 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
{
|
||||
case XIMasterKeyboard:
|
||||
case XIMasterPointer:
|
||||
type = GDK_DEVICE_TYPE_MASTER;
|
||||
type = GDK_DEVICE_TYPE_LOGICAL;
|
||||
break;
|
||||
case XISlaveKeyboard:
|
||||
case XISlavePointer:
|
||||
type = GDK_DEVICE_TYPE_SLAVE;
|
||||
type = GDK_DEVICE_TYPE_PHYSICAL;
|
||||
break;
|
||||
case XIFloatingSlave:
|
||||
default:
|
||||
@ -532,7 +532,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
|
||||
GDK_DISPLAY_NOTE (display, INPUT,
|
||||
({
|
||||
const gchar *type_names[] = { "master", "slave", "floating" };
|
||||
const gchar *type_names[] = { "logical", "physical", "floating" };
|
||||
const gchar *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" };
|
||||
g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d",
|
||||
dev->name,
|
||||
@ -590,7 +590,7 @@ ensure_seat_for_device_pair (GdkX11DeviceManagerXI2 *device_manager,
|
||||
keyboard = device2;
|
||||
}
|
||||
|
||||
seat = gdk_seat_default_new_for_master_pair (pointer, keyboard);
|
||||
seat = gdk_seat_default_new_for_logical_pair (pointer, keyboard);
|
||||
gdk_display_add_seat (display, seat);
|
||||
g_object_unref (seat);
|
||||
}
|
||||
@ -617,20 +617,20 @@ add_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
{
|
||||
if (dev->use == XISlavePointer || dev->use == XISlaveKeyboard)
|
||||
{
|
||||
GdkDevice *master;
|
||||
GdkDevice *logical;
|
||||
GdkSeat *seat;
|
||||
|
||||
/* The device manager is already constructed, then
|
||||
* keep the hierarchy coherent for the added device.
|
||||
*/
|
||||
master = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (dev->attachment));
|
||||
logical = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (dev->attachment));
|
||||
|
||||
_gdk_device_set_associated_device (device, master);
|
||||
_gdk_device_add_slave (master, device);
|
||||
_gdk_device_set_associated_device (device, logical);
|
||||
_gdk_device_add_physical_device (logical, device);
|
||||
|
||||
seat = gdk_device_get_seat (master);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), device);
|
||||
seat = gdk_device_get_seat (logical);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), device);
|
||||
}
|
||||
else if (dev->use == XIMasterPointer || dev->use == XIMasterKeyboard)
|
||||
{
|
||||
@ -659,10 +659,10 @@ detach_from_seat (GdkDevice *device)
|
||||
if (!seat)
|
||||
return;
|
||||
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL)
|
||||
gdk_display_remove_seat (gdk_device_get_display (device), seat);
|
||||
else if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_SLAVE)
|
||||
gdk_seat_default_remove_slave (GDK_SEAT_DEFAULT (seat), device);
|
||||
else if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL)
|
||||
gdk_seat_default_remove_physical_device (GDK_SEAT_DEFAULT (seat), device);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -688,9 +688,9 @@ remove_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
}
|
||||
|
||||
static void
|
||||
relate_masters (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
relate_logical_devices (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkX11DeviceManagerXI2 *device_manager;
|
||||
GdkDevice *device, *relative;
|
||||
@ -705,23 +705,23 @@ relate_masters (gpointer key,
|
||||
}
|
||||
|
||||
static void
|
||||
relate_slaves (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
relate_physical_devices (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkX11DeviceManagerXI2 *device_manager;
|
||||
GdkDevice *slave, *master;
|
||||
GdkDevice *physical, *logical;
|
||||
GdkSeat *seat;
|
||||
|
||||
device_manager = user_data;
|
||||
slave = g_hash_table_lookup (device_manager->id_table, key);
|
||||
master = g_hash_table_lookup (device_manager->id_table, value);
|
||||
physical = g_hash_table_lookup (device_manager->id_table, key);
|
||||
logical = g_hash_table_lookup (device_manager->id_table, value);
|
||||
|
||||
_gdk_device_set_associated_device (slave, master);
|
||||
_gdk_device_add_slave (master, slave);
|
||||
_gdk_device_set_associated_device (physical, logical);
|
||||
_gdk_device_add_physical_device (logical, physical);
|
||||
|
||||
seat = gdk_device_get_seat (master);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), slave);
|
||||
seat = gdk_device_get_seat (logical);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), physical);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -729,7 +729,7 @@ gdk_x11_device_manager_xi2_constructed (GObject *object)
|
||||
{
|
||||
GdkX11DeviceManagerXI2 *device_manager;
|
||||
GdkDisplay *display;
|
||||
GHashTable *masters, *slaves;
|
||||
GHashTable *logical_devices, *physical_devices;
|
||||
Display *xdisplay;
|
||||
XIDeviceInfo *info, *dev;
|
||||
int ndevices, i;
|
||||
@ -744,8 +744,8 @@ gdk_x11_device_manager_xi2_constructed (GObject *object)
|
||||
|
||||
g_assert (device_manager->major == 2);
|
||||
|
||||
masters = g_hash_table_new (NULL, NULL);
|
||||
slaves = g_hash_table_new (NULL, NULL);
|
||||
logical_devices = g_hash_table_new (NULL, NULL);
|
||||
physical_devices = g_hash_table_new (NULL, NULL);
|
||||
|
||||
info = XIQueryDevice (xdisplay, XIAllDevices, &ndevices);
|
||||
|
||||
@ -762,14 +762,14 @@ gdk_x11_device_manager_xi2_constructed (GObject *object)
|
||||
if (dev->use == XIMasterPointer ||
|
||||
dev->use == XIMasterKeyboard)
|
||||
{
|
||||
g_hash_table_insert (masters,
|
||||
g_hash_table_insert (logical_devices,
|
||||
GINT_TO_POINTER (dev->deviceid),
|
||||
GINT_TO_POINTER (dev->attachment));
|
||||
}
|
||||
else if (dev->use == XISlavePointer ||
|
||||
dev->use == XISlaveKeyboard)
|
||||
{
|
||||
g_hash_table_insert (slaves,
|
||||
g_hash_table_insert (physical_devices,
|
||||
GINT_TO_POINTER (dev->deviceid),
|
||||
GINT_TO_POINTER (dev->attachment));
|
||||
}
|
||||
@ -778,11 +778,11 @@ gdk_x11_device_manager_xi2_constructed (GObject *object)
|
||||
XIFreeDeviceInfo (info);
|
||||
|
||||
/* Stablish relationships between devices */
|
||||
g_hash_table_foreach (masters, relate_masters, object);
|
||||
g_hash_table_destroy (masters);
|
||||
g_hash_table_foreach (logical_devices, relate_logical_devices, object);
|
||||
g_hash_table_destroy (logical_devices);
|
||||
|
||||
g_hash_table_foreach (slaves, relate_slaves, object);
|
||||
g_hash_table_destroy (slaves);
|
||||
g_hash_table_foreach (physical_devices, relate_physical_devices, object);
|
||||
g_hash_table_destroy (physical_devices);
|
||||
|
||||
/* Connect to hierarchy change events */
|
||||
XISetMask (mask, XI_HierarchyChanged);
|
||||
@ -917,28 +917,28 @@ handle_hierarchy_changed (GdkX11DeviceManagerXI2 *device_manager,
|
||||
else if (ev->info[i].flags & XISlaveAttached ||
|
||||
ev->info[i].flags & XISlaveDetached)
|
||||
{
|
||||
GdkDevice *master, *slave;
|
||||
GdkDevice *logical, *physical;
|
||||
GdkSeat *seat;
|
||||
|
||||
slave = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (ev->info[i].deviceid));
|
||||
physical = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (ev->info[i].deviceid));
|
||||
|
||||
if (!slave)
|
||||
if (!physical)
|
||||
continue;
|
||||
|
||||
/* Remove old master info */
|
||||
master = gdk_device_get_associated_device (slave);
|
||||
/* Remove old logical device info */
|
||||
logical = gdk_device_get_associated_device (physical);
|
||||
|
||||
if (master)
|
||||
if (logical != NULL)
|
||||
{
|
||||
_gdk_device_remove_slave (master, slave);
|
||||
_gdk_device_set_associated_device (slave, NULL);
|
||||
_gdk_device_remove_physical_device (logical, physical);
|
||||
_gdk_device_set_associated_device (physical, NULL);
|
||||
|
||||
seat = gdk_device_get_seat (master);
|
||||
gdk_seat_default_remove_slave (GDK_SEAT_DEFAULT (seat), slave);
|
||||
seat = gdk_device_get_seat (logical);
|
||||
gdk_seat_default_remove_physical_device (GDK_SEAT_DEFAULT (seat), physical);
|
||||
}
|
||||
|
||||
/* Add new master if it's an attachment event */
|
||||
/* Add new logical device if it's an attachment event */
|
||||
if (ev->info[i].flags & XISlaveAttached)
|
||||
{
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
@ -946,18 +946,18 @@ handle_hierarchy_changed (GdkX11DeviceManagerXI2 *device_manager,
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
if (info)
|
||||
{
|
||||
master = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (info->attachment));
|
||||
logical = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (info->attachment));
|
||||
XIFreeDeviceInfo (info);
|
||||
}
|
||||
|
||||
if (master)
|
||||
if (logical != NULL)
|
||||
{
|
||||
_gdk_device_set_associated_device (slave, master);
|
||||
_gdk_device_add_slave (master, slave);
|
||||
_gdk_device_set_associated_device (physical, logical);
|
||||
_gdk_device_add_physical_device (logical, physical);
|
||||
|
||||
seat = gdk_device_get_seat (master);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), slave);
|
||||
seat = gdk_device_get_seat (logical);
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), physical);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1722,13 +1722,14 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
/* When scrolling, X might send events twice here; once with both the
|
||||
* device and the source device set to the physical device, and once
|
||||
* with the device set to the master device.
|
||||
* with the device set to the logical device.
|
||||
*
|
||||
* Since we are only interested in the latter, and
|
||||
* scroll_valuators_changed() updates the valuator cache for the
|
||||
* source device, we need to explicitly ignore the first event in
|
||||
* order to get the correct delta for the second.
|
||||
*/
|
||||
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE &&
|
||||
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL &&
|
||||
scroll_valuators_changed (GDK_X11_DEVICE_XI2 (source_device),
|
||||
&xev->valuators, &delta_x, &delta_y))
|
||||
{
|
||||
@ -1894,18 +1895,18 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab &&
|
||||
GDK_IS_TOPLEVEL (surface))
|
||||
{
|
||||
if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_MASTER)
|
||||
if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_LOGICAL)
|
||||
_gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
|
||||
else
|
||||
{
|
||||
GList *slaves, *l;
|
||||
GList *physical_devices, *l;
|
||||
|
||||
slaves = gdk_device_list_slave_devices (source_device);
|
||||
physical_devices = gdk_device_list_physical_devices (source_device);
|
||||
|
||||
for (l = slaves; l; l = l->next)
|
||||
for (l = physical_devices; l; l = l->next)
|
||||
_gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (l->data));
|
||||
|
||||
g_list_free (slaves);
|
||||
g_list_free (physical_devices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1765,7 +1765,9 @@ device_grab_update_callback (GdkDisplay *display,
|
||||
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
_gdk_display_device_grab_update (display, device,
|
||||
pointer_info->last_slave ? pointer_info->last_slave : device,
|
||||
pointer_info->last_physical_device != NULL
|
||||
? pointer_info->last_physical_device
|
||||
: device,
|
||||
serial);
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ _gdk_x11_surface_grab_check_unmap (GdkSurface *surface,
|
||||
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
|
||||
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
|
||||
|
||||
@ -169,7 +169,7 @@ _gdk_x11_surface_grab_check_destroy (GdkSurface *surface)
|
||||
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
|
||||
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
|
||||
|
||||
|
@ -4335,7 +4335,8 @@ _should_perform_ewmh_drag (GdkSurface *surface,
|
||||
display = gdk_surface_get_display (surface);
|
||||
info = _gdk_display_get_pointer_info (display, device);
|
||||
|
||||
if ((!info->last_slave || gdk_device_get_source (info->last_slave) != GDK_SOURCE_TOUCHSCREEN) &&
|
||||
if ((info->last_physical_device == NULL ||
|
||||
gdk_device_get_source (info->last_physical_device) != GDK_SOURCE_TOUCHSCREEN) &&
|
||||
gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
||||
g_intern_static_string ("_NET_WM_MOVERESIZE")))
|
||||
return TRUE;
|
||||
|
@ -895,7 +895,7 @@ gtk_gesture_init (GtkGesture *gesture)
|
||||
* gtk_gesture_get_device:
|
||||
* @gesture: a #GtkGesture
|
||||
*
|
||||
* Returns the master #GdkDevice that is currently operating
|
||||
* Returns the logical #GdkDevice that is currently operating
|
||||
* on @gesture, or %NULL if the gesture is not being interacted.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): a #GdkDevice, or %NULL
|
||||
|
@ -560,7 +560,7 @@ gtk_im_context_filter_key (GtkIMContext *context,
|
||||
|
||||
g_return_val_if_fail (GTK_IS_IM_CONTEXT (context), FALSE);
|
||||
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL)
|
||||
{
|
||||
source_device = NULL;
|
||||
}
|
||||
|
@ -7630,7 +7630,7 @@ _gtk_widget_list_devices (GtkWidget *widget,
|
||||
if (is_my_surface (widget, gdk_device_get_last_event_surface (device)))
|
||||
g_ptr_array_add (result, device);
|
||||
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL_POINTING);
|
||||
devices = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL_POINTING);
|
||||
for (l = devices; l; l = l->next)
|
||||
{
|
||||
device = l->data;
|
||||
|
@ -787,7 +787,7 @@ add_seat (GtkInspectorGeneral *gen,
|
||||
g_free (text);
|
||||
g_free (caps);
|
||||
|
||||
list = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
list = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
|
||||
for (l = list; l; l = l->next)
|
||||
add_device (gen, GDK_DEVICE (l->data));
|
||||
|
@ -42,7 +42,7 @@ test_default_seat (void)
|
||||
GdkSeat *seat0;
|
||||
GdkSeatCapabilities caps;
|
||||
GdkDevice *pointer0, *keyboard0, *device;
|
||||
GList *slaves, *l;
|
||||
GList *physical_devices, *l;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
seat0 = gdk_display_get_default_seat (display);
|
||||
@ -60,57 +60,57 @@ test_default_seat (void)
|
||||
g_assert (caps != GDK_SEAT_CAPABILITY_NONE);
|
||||
|
||||
pointer0 = gdk_seat_get_pointer (seat0);
|
||||
slaves = gdk_seat_get_slaves (seat0, GDK_SEAT_CAPABILITY_POINTER);
|
||||
physical_devices = gdk_seat_get_physical_devices (seat0, GDK_SEAT_CAPABILITY_POINTER);
|
||||
|
||||
if ((caps & GDK_SEAT_CAPABILITY_POINTER) != 0)
|
||||
{
|
||||
g_assert_nonnull (pointer0);
|
||||
g_assert (gdk_device_get_device_type (pointer0) == GDK_DEVICE_TYPE_MASTER);
|
||||
g_assert (gdk_device_get_device_type (pointer0) == GDK_DEVICE_TYPE_LOGICAL);
|
||||
g_assert (gdk_device_get_display (pointer0) == display);
|
||||
g_assert (gdk_device_get_seat (pointer0) == seat0);
|
||||
|
||||
g_assert_nonnull (slaves);
|
||||
for (l = slaves; l; l = l->next)
|
||||
g_assert_nonnull (physical_devices);
|
||||
for (l = physical_devices; l; l = l->next)
|
||||
{
|
||||
device = l->data;
|
||||
g_assert (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_SLAVE);
|
||||
g_assert (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL);
|
||||
g_assert (gdk_device_get_display (device) == display);
|
||||
g_assert (gdk_device_get_seat (device) == seat0);
|
||||
}
|
||||
g_list_free (slaves);
|
||||
g_list_free (physical_devices);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_null (pointer0);
|
||||
g_assert_null (slaves);
|
||||
g_assert_null (physical_devices);
|
||||
}
|
||||
|
||||
keyboard0 = gdk_seat_get_keyboard (seat0);
|
||||
slaves = gdk_seat_get_slaves (seat0, GDK_SEAT_CAPABILITY_KEYBOARD);
|
||||
physical_devices = gdk_seat_get_physical_devices (seat0, GDK_SEAT_CAPABILITY_KEYBOARD);
|
||||
|
||||
if ((caps & GDK_SEAT_CAPABILITY_KEYBOARD) != 0)
|
||||
{
|
||||
g_assert_nonnull (keyboard0);
|
||||
g_assert (gdk_device_get_device_type (keyboard0) == GDK_DEVICE_TYPE_MASTER);
|
||||
g_assert (gdk_device_get_device_type (keyboard0) == GDK_DEVICE_TYPE_LOGICAL);
|
||||
g_assert (gdk_device_get_display (keyboard0) == display);
|
||||
g_assert (gdk_device_get_seat (keyboard0) == seat0);
|
||||
g_assert (gdk_device_get_source (keyboard0) == GDK_SOURCE_KEYBOARD);
|
||||
|
||||
g_assert_nonnull (slaves);
|
||||
for (l = slaves; l; l = l->next)
|
||||
g_assert_nonnull (physical_devices);
|
||||
for (l = physical_devices; l; l = l->next)
|
||||
{
|
||||
device = l->data;
|
||||
g_assert (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_SLAVE);
|
||||
g_assert (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL);
|
||||
g_assert (gdk_device_get_display (device) == display);
|
||||
g_assert (gdk_device_get_seat (device) == seat0);
|
||||
g_assert (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
|
||||
}
|
||||
g_list_free (slaves);
|
||||
g_list_free (physical_devices);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_null (keyboard0);
|
||||
g_assert_null (slaves);
|
||||
g_assert_null (physical_devices);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user