forked from AuroraMiddleware/gtk
gdk/x11: Make device type a X11 detail
The only legit uses of device types are here in gdk/x11, move the concept of device type to X11, so we can drop it from public API.
This commit is contained in:
parent
3c68db8e47
commit
4a2050e220
@ -50,6 +50,7 @@ struct _GdkX11DeviceXI2
|
||||
int device_id;
|
||||
GArray *scroll_valuators;
|
||||
double *last_axes;
|
||||
GdkX11DeviceType device_type;
|
||||
};
|
||||
|
||||
struct _GdkX11DeviceXI2Class
|
||||
@ -190,7 +191,7 @@ gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
|
||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||
|
||||
/* Non-logical devices don't have a cursor */
|
||||
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL)
|
||||
if (device_xi2->device_type != GDK_X11_DEVICE_TYPE_LOGICAL)
|
||||
return;
|
||||
|
||||
if (cursor)
|
||||
@ -773,3 +774,16 @@ gdk_x11_device_xi2_store_axes (GdkX11DeviceXI2 *device,
|
||||
else
|
||||
device->last_axes = NULL;
|
||||
}
|
||||
|
||||
GdkX11DeviceType
|
||||
gdk_x11_device_xi2_get_device_type (GdkX11DeviceXI2 *device)
|
||||
{
|
||||
return device->device_type;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_x11_device_xi2_set_device_type (GdkX11DeviceXI2 *device,
|
||||
GdkX11DeviceType type)
|
||||
{
|
||||
device->device_type = type;
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
{
|
||||
GdkInputSource input_source;
|
||||
GdkInputSource touch_source;
|
||||
GdkDeviceType type;
|
||||
GdkX11DeviceType type;
|
||||
GdkDevice *device;
|
||||
int num_touches = 0;
|
||||
char *vendor_id = NULL, *product_id = NULL;
|
||||
@ -515,15 +515,15 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
{
|
||||
case XIMasterKeyboard:
|
||||
case XIMasterPointer:
|
||||
type = GDK_DEVICE_TYPE_LOGICAL;
|
||||
type = GDK_X11_DEVICE_TYPE_LOGICAL;
|
||||
break;
|
||||
case XISlaveKeyboard:
|
||||
case XISlavePointer:
|
||||
type = GDK_DEVICE_TYPE_PHYSICAL;
|
||||
type = GDK_X11_DEVICE_TYPE_PHYSICAL;
|
||||
break;
|
||||
case XIFloatingSlave:
|
||||
default:
|
||||
type = GDK_DEVICE_TYPE_FLOATING;
|
||||
type = GDK_X11_DEVICE_TYPE_FLOATING;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -545,7 +545,6 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
|
||||
device = g_object_new (GDK_TYPE_X11_DEVICE_XI2,
|
||||
"name", dev->name,
|
||||
"type", type,
|
||||
"source", input_source,
|
||||
"has-cursor", (dev->use == XIMasterPointer),
|
||||
"display", display,
|
||||
@ -554,6 +553,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
"product-id", product_id,
|
||||
"num-touches", num_touches,
|
||||
NULL);
|
||||
gdk_x11_device_xi2_set_device_type ((GdkX11DeviceXI2 *) device, type);
|
||||
|
||||
translate_device_classes (display, device, dev->classes, dev->num_classes);
|
||||
g_free (vendor_id);
|
||||
@ -652,13 +652,14 @@ static void
|
||||
detach_from_seat (GdkDevice *device)
|
||||
{
|
||||
GdkSeat *seat = gdk_device_get_seat (device);
|
||||
GdkX11DeviceXI2 *device_xi2 = (GdkX11DeviceXI2 *) device;
|
||||
|
||||
if (!seat)
|
||||
return;
|
||||
|
||||
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL)
|
||||
if (gdk_x11_device_xi2_get_device_type (device_xi2) == GDK_X11_DEVICE_TYPE_LOGICAL)
|
||||
gdk_display_remove_seat (gdk_device_get_display (device), seat);
|
||||
else if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL)
|
||||
else if (gdk_x11_device_xi2_get_device_type (device_xi2) == GDK_X11_DEVICE_TYPE_PHYSICAL)
|
||||
gdk_seat_default_remove_physical_device (GDK_SEAT_DEFAULT (seat), device);
|
||||
}
|
||||
|
||||
@ -1711,7 +1712,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
* 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_PHYSICAL &&
|
||||
if (gdk_x11_device_xi2_get_device_type ((GdkX11DeviceXI2 *) device) != GDK_X11_DEVICE_TYPE_PHYSICAL &&
|
||||
scroll_valuators_changed (GDK_X11_DEVICE_XI2 (source_device),
|
||||
&xev->valuators, &delta_x, &delta_y))
|
||||
{
|
||||
@ -1886,7 +1887,7 @@ 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_LOGICAL)
|
||||
if (gdk_x11_device_xi2_get_device_type ((GdkX11DeviceXI2 *) device) != GDK_X11_DEVICE_TYPE_LOGICAL)
|
||||
_gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
|
||||
else
|
||||
{
|
||||
|
@ -32,9 +32,19 @@ G_BEGIN_DECLS
|
||||
typedef struct _GdkX11DeviceXI2 GdkX11DeviceXI2;
|
||||
typedef struct _GdkX11DeviceXI2Class GdkX11DeviceXI2Class;
|
||||
|
||||
typedef enum {
|
||||
GDK_X11_DEVICE_TYPE_LOGICAL,
|
||||
GDK_X11_DEVICE_TYPE_PHYSICAL,
|
||||
GDK_X11_DEVICE_TYPE_FLOATING
|
||||
} GdkX11DeviceType;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_x11_device_xi2_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkX11DeviceType gdk_x11_device_xi2_get_device_type (GdkX11DeviceXI2 *device);
|
||||
void gdk_x11_device_xi2_set_device_type (GdkX11DeviceXI2 *device,
|
||||
GdkX11DeviceType type);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_X11_DEVICE_XI2_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user