mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
backends/x11: Move to backend-specific meta_input_device_x11_get_device_id()
Make this info part of the MetaInputDeviceX11, as it's actually just relevant to that backend. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1569>
This commit is contained in:
parent
045181f321
commit
7738ce2a64
@ -394,6 +394,16 @@ meta_input_device_x11_get_pointer_location (ClutterInputDevice *device,
|
||||
return device_xi2->query_status;
|
||||
}
|
||||
|
||||
int
|
||||
meta_input_device_x11_get_device_id (ClutterInputDevice *device)
|
||||
{
|
||||
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||||
|
||||
g_return_val_if_fail (META_IS_INPUT_DEVICE_X11 (device), 0);
|
||||
|
||||
return device_xi2->device_id;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBWACOM
|
||||
uint32_t
|
||||
meta_input_device_x11_get_pad_group_mode (ClutterInputDevice *device,
|
||||
|
@ -69,6 +69,7 @@ void meta_input_device_x11_update_pad_state (ClutterInputDevice *device,
|
||||
gboolean meta_input_device_x11_get_pointer_location (ClutterInputDevice *device,
|
||||
float *x,
|
||||
float *y);
|
||||
int meta_input_device_x11_get_device_id (ClutterInputDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-input-device-x11.h"
|
||||
#include "core/display-private.h"
|
||||
#include "meta/meta-x11-errors.h"
|
||||
|
||||
@ -77,7 +78,7 @@ device_ensure_xdevice (ClutterInputDevice *device)
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
int device_id = clutter_input_device_get_device_id (device);
|
||||
int device_id = meta_input_device_x11_get_device_id (device);
|
||||
XDevice *xdev = NULL;
|
||||
|
||||
xdev = g_object_get_data (G_OBJECT (device), "meta-input-settings-xdevice");
|
||||
@ -116,7 +117,7 @@ get_property (ClutterInputDevice *device,
|
||||
if (!property_atom)
|
||||
return NULL;
|
||||
|
||||
device_id = clutter_input_device_get_device_id (device);
|
||||
device_id = meta_input_device_x11_get_device_id (device);
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (xdisplay, device_id, property_atom,
|
||||
@ -154,7 +155,7 @@ change_property (ClutterInputDevice *device,
|
||||
if (!property_atom)
|
||||
return;
|
||||
|
||||
device_id = clutter_input_device_get_device_id (device);
|
||||
device_id = meta_input_device_x11_get_device_id (device);
|
||||
|
||||
data_ret = get_property (device, property, type, format, nitems);
|
||||
if (!data_ret)
|
||||
@ -674,7 +675,7 @@ device_query_area (ClutterInputDevice *device,
|
||||
Atom abs_x, abs_y;
|
||||
|
||||
*width = *height = 0;
|
||||
device_id = clutter_input_device_get_device_id (device);
|
||||
device_id = meta_input_device_x11_get_device_id (device);
|
||||
info = XIQueryDevice (xdisplay, device_id, &n_devices);
|
||||
if (n_devices <= 0 || !info)
|
||||
return FALSE;
|
||||
|
@ -145,7 +145,7 @@ translate_valuator_class (Display *xdisplay,
|
||||
class->min,
|
||||
class->max,
|
||||
class->resolution,
|
||||
device->id);
|
||||
meta_input_device_x11_get_device_id (device));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -577,7 +577,7 @@ pad_passive_button_grab (ClutterInputDevice *device)
|
||||
XIEventMask xi_event_mask;
|
||||
int device_id, rc;
|
||||
|
||||
device_id = clutter_input_device_get_device_id (device);
|
||||
device_id = meta_input_device_x11_get_device_id (device);
|
||||
|
||||
xi_event_mask.deviceid = device_id;
|
||||
xi_event_mask.mask_len = XIMaskLen (XI_LASTEVENT);
|
||||
@ -791,7 +791,7 @@ device_get_tool_serial (ClutterInputDevice *device)
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (clutter_x11_get_default_display (),
|
||||
clutter_input_device_get_device_id (device),
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
prop, 0, 4, FALSE, XA_INTEGER, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
clutter_x11_untrap_x_errors ();
|
||||
@ -980,7 +980,7 @@ translate_raw_event (MetaSeatX11 *seat_x11,
|
||||
{
|
||||
case XI_RawMotion:
|
||||
g_debug ("raw motion: device:%d '%s'",
|
||||
device->id,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name);
|
||||
|
||||
/* We don't get actual pointer location with raw events, and we cannot
|
||||
@ -997,7 +997,7 @@ translate_raw_event (MetaSeatX11 *seat_x11,
|
||||
cookie->evtype == XI_RawButtonPress
|
||||
? "press "
|
||||
: "release",
|
||||
device->id,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
xev->detail);
|
||||
_clutter_input_pointer_a11y_on_button_event (device,
|
||||
@ -1102,7 +1102,7 @@ translate_pad_event (ClutterEvent *event,
|
||||
? "pad ring "
|
||||
: "pad strip",
|
||||
(unsigned int) xev->event,
|
||||
device->id,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
event->any.time, value);
|
||||
|
||||
@ -1914,7 +1914,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
? "pad button press "
|
||||
: "pad button release",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
device->id,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
event->any.time,
|
||||
event->pad_button.button);
|
||||
@ -1964,7 +1964,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
"x:%.2f, y:%.2f, "
|
||||
"emulated:%s)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
device->id,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
event->any.time,
|
||||
event->scroll.direction == CLUTTER_SCROLL_UP ? "up" :
|
||||
@ -2010,7 +2010,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
? "button press "
|
||||
: "button release",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
device->id,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
event->any.time,
|
||||
event->button.button,
|
||||
@ -2073,7 +2073,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
|
||||
g_debug ("smooth scroll: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, delta:%f, %f)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
event->scroll.device->id,
|
||||
meta_input_device_x11_get_device_id (event->scroll.device),
|
||||
event->scroll.device->device_name,
|
||||
event->scroll.x,
|
||||
event->scroll.y,
|
||||
@ -2109,7 +2109,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
|
||||
g_debug ("motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
event->motion.device->id,
|
||||
meta_input_device_x11_get_device_id (event->motion.device),
|
||||
event->motion.device->device_name,
|
||||
event->motion.x,
|
||||
event->motion.y,
|
||||
@ -2172,7 +2172,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
g_debug ("touch %s: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
|
||||
event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
event->touch.device->id,
|
||||
meta_input_device_x11_get_device_id (event->touch.device),
|
||||
event->touch.device->device_name,
|
||||
GPOINTER_TO_UINT (event->touch.sequence),
|
||||
event->touch.x,
|
||||
@ -2218,7 +2218,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
|
||||
g_debug ("touch update: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
event->touch.device->id,
|
||||
meta_input_device_x11_get_device_id (event->touch.device),
|
||||
event->touch.device->device_name,
|
||||
GPOINTER_TO_UINT (event->touch.sequence),
|
||||
event->touch.x,
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
#include "backends/meta-idle-monitor-private.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-input-device-x11.h"
|
||||
#include "compositor/meta-window-actor-private.h"
|
||||
#include "core/display-private.h"
|
||||
#include "core/window-private.h"
|
||||
@ -175,7 +176,7 @@ maybe_unfreeze_pointer_events (MetaBackend *backend,
|
||||
return;
|
||||
|
||||
device = clutter_event_get_device (event);
|
||||
device_id = clutter_input_device_get_device_id (device);
|
||||
device_id = meta_input_device_x11_get_device_id (device);
|
||||
switch (unfreeze_method)
|
||||
{
|
||||
case EVENTS_UNFREEZE_SYNC:
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-monitor-manager-private.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-input-device-x11.h"
|
||||
#include "compositor/compositor-private.h"
|
||||
#include "core/edge-resistance.h"
|
||||
#include "core/frame.h"
|
||||
@ -2075,7 +2076,7 @@ process_special_modifier_key (MetaDisplay *display,
|
||||
|
||||
if (xdisplay)
|
||||
XIAllowEvents (xdisplay,
|
||||
clutter_input_device_get_device_id (event->device),
|
||||
meta_input_device_x11_get_device_id (event->device),
|
||||
XIAsyncDevice, event->time);
|
||||
}
|
||||
else
|
||||
@ -2084,7 +2085,7 @@ process_special_modifier_key (MetaDisplay *display,
|
||||
* per-window key bindings or to the application */
|
||||
if (xdisplay)
|
||||
XIAllowEvents (xdisplay,
|
||||
clutter_input_device_get_device_id (event->device),
|
||||
meta_input_device_x11_get_device_id (event->device),
|
||||
XIReplayDevice, event->time);
|
||||
}
|
||||
}
|
||||
@ -2098,7 +2099,7 @@ process_special_modifier_key (MetaDisplay *display,
|
||||
* starts typing into the overlay we get all the keys */
|
||||
if (xdisplay)
|
||||
XIAllowEvents (xdisplay,
|
||||
clutter_input_device_get_device_id (event->device),
|
||||
meta_input_device_x11_get_device_id (event->device),
|
||||
XIAsyncDevice, event->time);
|
||||
|
||||
binding = get_keybinding (keys, resolved_key_combo);
|
||||
@ -2123,7 +2124,7 @@ process_special_modifier_key (MetaDisplay *display,
|
||||
*/
|
||||
if (xdisplay)
|
||||
XIAllowEvents (xdisplay,
|
||||
clutter_input_device_get_device_id (event->device),
|
||||
meta_input_device_x11_get_device_id (event->device),
|
||||
XIAsyncDevice, event->time);
|
||||
}
|
||||
|
||||
@ -2139,7 +2140,7 @@ process_special_modifier_key (MetaDisplay *display,
|
||||
* on the next event if it's not the release of the modifier key */
|
||||
if (xdisplay)
|
||||
XIAllowEvents (xdisplay,
|
||||
clutter_input_device_get_device_id (event->device),
|
||||
meta_input_device_x11_get_device_id (event->device),
|
||||
XISyncDevice, event->time);
|
||||
|
||||
return TRUE;
|
||||
@ -2258,7 +2259,7 @@ process_key_event (MetaDisplay *display,
|
||||
{
|
||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||
XIAllowEvents (xdisplay,
|
||||
clutter_input_device_get_device_id (event->device),
|
||||
meta_input_device_x11_get_device_id (event->device),
|
||||
XIAsyncDevice, event->time);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user