seat/x11: Keep a pointer to the backend
This adds a pointer to the backend and replaces places that fetched backend resources via globals (mostly via clutter). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
This commit is contained in:
parent
56f150aa31
commit
6f80c1e7b5
@ -653,7 +653,8 @@ meta_backend_x11_create_default_seat (MetaBackend *backend,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
seat_x11 = meta_seat_x11_new (event_base,
|
||||
seat_x11 = meta_seat_x11_new (backend,
|
||||
event_base,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
META_VIRTUAL_CORE_KEYBOARD_ID);
|
||||
return CLUTTER_SEAT (seat_x11);
|
||||
|
@ -39,6 +39,7 @@
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BACKEND,
|
||||
PROP_OPCODE,
|
||||
PROP_POINTER_ID,
|
||||
PROP_KEYBOARD_ID,
|
||||
@ -60,6 +61,9 @@ struct _MetaTouchInfo
|
||||
struct _MetaSeatX11
|
||||
{
|
||||
ClutterSeat parent_instance;
|
||||
|
||||
MetaBackend *backend;
|
||||
|
||||
ClutterInputDevice *core_pointer;
|
||||
ClutterInputDevice *core_keyboard;
|
||||
GList *devices;
|
||||
@ -122,6 +126,12 @@ enum
|
||||
|
||||
static Atom clutter_input_axis_atoms[N_AXIS_ATOMS] = { 0, };
|
||||
|
||||
static Display *
|
||||
xdisplay_from_seat (MetaSeatX11 *seat_x11)
|
||||
{
|
||||
return meta_backend_x11_get_xdisplay (META_BACKEND_X11 (seat_x11->backend));
|
||||
}
|
||||
|
||||
static void
|
||||
translate_valuator_class (Display *xdisplay,
|
||||
ClutterInputDevice *device,
|
||||
@ -249,21 +259,23 @@ is_touch_device (XIAnyClassInfo **classes,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_touchpad_device (XIDeviceInfo *info)
|
||||
is_touchpad_device (MetaSeatX11 *seat_x11,
|
||||
XIDeviceInfo *info)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
gulong nitems, bytes_after;
|
||||
uint32_t *data = NULL;
|
||||
int rc, format;
|
||||
Atom type;
|
||||
Atom prop;
|
||||
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (),
|
||||
prop = XInternAtom (xdisplay,
|
||||
"libinput Tapping Enabled", True);
|
||||
if (prop == None)
|
||||
return FALSE;
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
rc = XIGetProperty (xdisplay,
|
||||
info->deviceid,
|
||||
prop,
|
||||
0, 1, False, XA_INTEGER, &type, &format, &nitems, &bytes_after,
|
||||
@ -280,19 +292,21 @@ is_touchpad_device (XIDeviceInfo *info)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_device_ids (XIDeviceInfo *info,
|
||||
get_device_ids (MetaSeatX11 *seat_x11,
|
||||
XIDeviceInfo *info,
|
||||
char **vendor_id,
|
||||
char **product_id)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
gulong nitems, bytes_after;
|
||||
uint32_t *data = NULL;
|
||||
int rc, format;
|
||||
Atom type;
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
rc = XIGetProperty (xdisplay,
|
||||
info->deviceid,
|
||||
XInternAtom (meta_clutter_x11_get_default_display (), "Device Product ID", False),
|
||||
XInternAtom (xdisplay, "Device Product ID", False),
|
||||
0, 2, False, XA_INTEGER, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
@ -314,21 +328,23 @@ get_device_ids (XIDeviceInfo *info,
|
||||
}
|
||||
|
||||
static char *
|
||||
get_device_node_path (XIDeviceInfo *info)
|
||||
get_device_node_path (MetaSeatX11 *seat_x11,
|
||||
XIDeviceInfo *info)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
gulong nitems, bytes_after;
|
||||
guchar *data;
|
||||
int rc, format;
|
||||
Atom prop, type;
|
||||
char *node_path;
|
||||
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (), "Device Node", False);
|
||||
prop = XInternAtom (xdisplay, "Device Node", False);
|
||||
if (prop == None)
|
||||
return NULL;
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
rc = XIGetProperty (xdisplay,
|
||||
info->deviceid, prop, 0, 1024, False,
|
||||
XA_STRING, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
@ -381,9 +397,11 @@ get_pad_features (XIDeviceInfo *info,
|
||||
/* The Wacom driver exports the tool type as property. Use that over
|
||||
guessing based on the device name */
|
||||
static gboolean
|
||||
guess_source_from_wacom_type (XIDeviceInfo *info,
|
||||
guess_source_from_wacom_type (MetaSeatX11 *seat_x11,
|
||||
XIDeviceInfo *info,
|
||||
ClutterInputDeviceType *source_out)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
gulong nitems, bytes_after;
|
||||
uint32_t *data = NULL;
|
||||
int rc, format;
|
||||
@ -392,12 +410,12 @@ guess_source_from_wacom_type (XIDeviceInfo *info,
|
||||
Atom device_type;
|
||||
Atom types[N_WACOM_TYPE_ATOMS];
|
||||
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (), "Wacom Tool Type", True);
|
||||
prop = XInternAtom (xdisplay, "Wacom Tool Type", True);
|
||||
if (prop == None)
|
||||
return FALSE;
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
rc = XIGetProperty (xdisplay,
|
||||
info->deviceid,
|
||||
prop,
|
||||
0, 1, False, XA_ATOM, &type, &format, &nitems, &bytes_after,
|
||||
@ -416,7 +434,7 @@ guess_source_from_wacom_type (XIDeviceInfo *info,
|
||||
if (device_type == 0)
|
||||
return FALSE;
|
||||
|
||||
rc = XInternAtoms (meta_clutter_x11_get_default_display (),
|
||||
rc = XInternAtoms (xdisplay,
|
||||
(char **)wacom_type_atoms,
|
||||
N_WACOM_TYPE_ATOMS,
|
||||
False,
|
||||
@ -461,6 +479,7 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
ClutterBackend *backend,
|
||||
XIDeviceInfo *info)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
ClutterInputDeviceType source, touch_source;
|
||||
ClutterInputDevice *retval;
|
||||
ClutterInputMode mode;
|
||||
@ -471,7 +490,7 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
{
|
||||
source = CLUTTER_KEYBOARD_DEVICE;
|
||||
}
|
||||
else if (is_touchpad_device (info))
|
||||
else if (is_touchpad_device (seat_x11, info))
|
||||
{
|
||||
source = CLUTTER_TOUCHPAD_DEVICE;
|
||||
}
|
||||
@ -482,7 +501,7 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
{
|
||||
source = touch_source;
|
||||
}
|
||||
else if (!guess_source_from_wacom_type (info, &source))
|
||||
else if (!guess_source_from_wacom_type (seat_x11, info, &source))
|
||||
{
|
||||
char *name;
|
||||
|
||||
@ -525,8 +544,8 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
if (info->use != XIMasterKeyboard &&
|
||||
info->use != XIMasterPointer)
|
||||
{
|
||||
get_device_ids (info, &vendor_id, &product_id);
|
||||
node_path = get_device_node_path (info);
|
||||
get_device_ids (seat_x11, info, &vendor_id, &product_id);
|
||||
node_path = get_device_node_path (seat_x11, info);
|
||||
}
|
||||
|
||||
if (source == CLUTTER_PAD_DEVICE)
|
||||
@ -548,7 +567,7 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
"seat", seat_x11,
|
||||
NULL);
|
||||
|
||||
translate_device_classes (meta_clutter_x11_get_default_display (), retval,
|
||||
translate_device_classes (xdisplay, retval,
|
||||
info->classes,
|
||||
info->num_classes);
|
||||
|
||||
@ -565,8 +584,10 @@ create_device (MetaSeatX11 *seat_x11,
|
||||
}
|
||||
|
||||
static void
|
||||
pad_passive_button_grab (ClutterInputDevice *device)
|
||||
pad_passive_button_grab (MetaSeatX11 *seat_x11,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
XIGrabModifiers xi_grab_mods = { XIAnyModifier, };
|
||||
XIEventMask xi_event_mask;
|
||||
int device_id, rc;
|
||||
@ -582,7 +603,7 @@ pad_passive_button_grab (ClutterInputDevice *device)
|
||||
XISetMask (xi_event_mask.mask, XI_ButtonRelease);
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGrabButton (meta_clutter_x11_get_default_display (),
|
||||
rc = XIGrabButton (xdisplay,
|
||||
device_id, XIAnyButton,
|
||||
meta_clutter_x11_get_root_window (), None,
|
||||
XIGrabModeSync, XIGrabModeSync,
|
||||
@ -594,9 +615,7 @@ pad_passive_button_grab (ClutterInputDevice *device)
|
||||
}
|
||||
else
|
||||
{
|
||||
XIAllowEvents (meta_clutter_x11_get_default_display (),
|
||||
device_id, XIAsyncDevice,
|
||||
CLUTTER_CURRENT_TIME);
|
||||
XIAllowEvents (xdisplay, device_id, XIAsyncDevice, CLUTTER_CURRENT_TIME);
|
||||
}
|
||||
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
@ -655,7 +674,7 @@ add_device (MetaSeatX11 *seat_x11,
|
||||
}
|
||||
|
||||
if (clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE)
|
||||
pad_passive_button_grab (device);
|
||||
pad_passive_button_grab (seat_x11, device);
|
||||
|
||||
return device;
|
||||
}
|
||||
@ -708,7 +727,7 @@ meta_seat_x11_handle_event_post (ClutterSeat *seat,
|
||||
device = clutter_event_get_device (event);
|
||||
is_touch =
|
||||
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE;
|
||||
input_settings = meta_backend_get_input_settings (meta_get_backend ());
|
||||
input_settings = meta_backend_get_input_settings (seat_x11->backend);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
@ -732,8 +751,10 @@ meta_seat_x11_handle_event_post (ClutterSeat *seat,
|
||||
}
|
||||
|
||||
static uint
|
||||
device_get_tool_serial (ClutterInputDevice *device)
|
||||
device_get_tool_serial (MetaSeatX11 *seat_x11,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
gulong nitems, bytes_after;
|
||||
uint32_t *data = NULL;
|
||||
int serial_id = 0;
|
||||
@ -741,13 +762,12 @@ device_get_tool_serial (ClutterInputDevice *device)
|
||||
Atom type;
|
||||
Atom prop;
|
||||
|
||||
prop = XInternAtom (meta_clutter_x11_get_default_display (),
|
||||
"Wacom Serial IDs", True);
|
||||
prop = XInternAtom (xdisplay, "Wacom Serial IDs", True);
|
||||
if (prop == None)
|
||||
return 0;
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
rc = XIGetProperty (meta_clutter_x11_get_default_display (),
|
||||
rc = XIGetProperty (xdisplay,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
prop, 0, 4, FALSE, XA_INTEGER, &type, &format, &nitems, &bytes_after,
|
||||
(guchar **) &data);
|
||||
@ -767,6 +787,7 @@ translate_hierarchy_event (ClutterBackend *backend,
|
||||
XIHierarchyEvent *ev,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
int i;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
@ -782,7 +803,7 @@ translate_hierarchy_event (ClutterBackend *backend,
|
||||
g_debug ("Hierarchy event: device enabled");
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
info = XIQueryDevice (meta_clutter_x11_get_default_display (),
|
||||
info = XIQueryDevice (xdisplay,
|
||||
ev->info[i].deviceid,
|
||||
&n_devices);
|
||||
meta_clutter_x11_untrap_x_errors ();
|
||||
@ -838,12 +859,12 @@ static void
|
||||
translate_property_event (MetaSeatX11 *seat_x11,
|
||||
XIEvent *event)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
XIPropertyEvent *xev = (XIPropertyEvent *) event;
|
||||
Atom serial_ids_prop;
|
||||
ClutterInputDevice *device;
|
||||
|
||||
serial_ids_prop = XInternAtom (meta_clutter_x11_get_default_display (),
|
||||
"Wacom Serial IDs", True);
|
||||
serial_ids_prop = XInternAtom (xdisplay, "Wacom Serial IDs", True);
|
||||
if (serial_ids_prop == None)
|
||||
return;
|
||||
|
||||
@ -859,7 +880,7 @@ translate_property_event (MetaSeatX11 *seat_x11,
|
||||
MetaInputSettings *input_settings;
|
||||
int serial_id;
|
||||
|
||||
serial_id = device_get_tool_serial (device);
|
||||
serial_id = device_get_tool_serial (seat_x11, device);
|
||||
|
||||
if (serial_id != 0)
|
||||
{
|
||||
@ -877,7 +898,7 @@ translate_property_event (MetaSeatX11 *seat_x11,
|
||||
}
|
||||
|
||||
meta_input_device_x11_update_tool (device, tool);
|
||||
input_settings = meta_backend_get_input_settings (meta_get_backend ());
|
||||
input_settings = meta_backend_get_input_settings (seat_x11->backend);
|
||||
meta_input_settings_notify_tool_change (input_settings, device, tool);
|
||||
}
|
||||
}
|
||||
@ -892,7 +913,7 @@ emulate_motion (MetaSeatX11 *seat_x11,
|
||||
ClutterStage *stage;
|
||||
|
||||
pointer = clutter_seat_get_pointer (CLUTTER_SEAT (seat_x11));
|
||||
stage = CLUTTER_STAGE (meta_backend_get_stage (meta_get_backend ()));
|
||||
stage = CLUTTER_STAGE (meta_backend_get_stage (seat_x11->backend));
|
||||
|
||||
event = clutter_event_new (CLUTTER_MOTION);
|
||||
clutter_event_set_flags (event, CLUTTER_EVENT_FLAG_SYNTHETIC);
|
||||
@ -1100,7 +1121,7 @@ get_event_stage (MetaSeatX11 *seat_x11,
|
||||
break;
|
||||
|
||||
case XI_HierarchyChanged:
|
||||
return CLUTTER_STAGE (meta_backend_get_stage (meta_get_backend ()));
|
||||
return CLUTTER_STAGE (meta_backend_get_stage (seat_x11->backend));
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -1278,13 +1299,14 @@ on_keymap_state_change (MetaKeymapX11 *keymap_x11,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterSeat *seat = data;
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
MetaInputSettings *input_settings;
|
||||
MetaKbdA11ySettings kbd_a11y_settings;
|
||||
|
||||
/* On keymaps state change, just reapply the current settings, it'll
|
||||
* take care of enabling/disabling mousekeys based on NumLock state.
|
||||
*/
|
||||
input_settings = meta_backend_get_input_settings (meta_get_backend ());
|
||||
input_settings = meta_backend_get_input_settings (seat_x11->backend);
|
||||
meta_input_settings_get_kbd_a11y_settings (input_settings, &kbd_a11y_settings);
|
||||
meta_seat_x11_apply_kbd_a11y_settings (seat, &kbd_a11y_settings);
|
||||
}
|
||||
@ -1299,6 +1321,9 @@ meta_seat_x11_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
seat_x11->backend = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_OPCODE:
|
||||
seat_x11->opcode = g_value_get_int (value);
|
||||
break;
|
||||
@ -1324,6 +1349,9 @@ meta_seat_x11_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, seat_x11->backend);
|
||||
break;
|
||||
case PROP_OPCODE:
|
||||
g_value_set_int (value, seat_x11->opcode);
|
||||
break;
|
||||
@ -1365,14 +1393,13 @@ static void
|
||||
meta_seat_x11_constructed (GObject *object)
|
||||
{
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (object);
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
ClutterBackend *backend =
|
||||
meta_backend_get_clutter_backend (seat_x11->backend);
|
||||
XIDeviceInfo *info;
|
||||
XIEventMask event_mask;
|
||||
unsigned char mask[XIMaskLen(XI_LASTEVENT)] = { 0, };
|
||||
int n_devices, i;
|
||||
Display *xdisplay;
|
||||
|
||||
xdisplay = meta_clutter_x11_get_default_display ();
|
||||
|
||||
info = XIQueryDevice (xdisplay, XIAllDevices, &n_devices);
|
||||
|
||||
@ -1501,9 +1528,10 @@ meta_seat_x11_warp_pointer (ClutterSeat *seat,
|
||||
int y)
|
||||
{
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
XIWarpPointer (meta_clutter_x11_get_default_display (),
|
||||
XIWarpPointer (xdisplay,
|
||||
seat_x11->pointer_id,
|
||||
None,
|
||||
meta_clutter_x11_get_root_window (),
|
||||
@ -1566,8 +1594,9 @@ meta_seat_x11_query_state (ClutterSeat *seat,
|
||||
graphene_point_t *coords,
|
||||
ClutterModifierType *modifiers)
|
||||
{
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (meta_get_backend ());
|
||||
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
|
||||
MetaBackendX11 *backend_x11 = META_BACKEND_X11 (seat_x11->backend);
|
||||
Display *xdisplay = xdisplay_from_seat (seat_x11);
|
||||
Window root_ret, child_ret;
|
||||
double root_x, root_y, win_x, win_y;
|
||||
XIButtonState button_state = { 0 };
|
||||
@ -1575,7 +1604,7 @@ meta_seat_x11_query_state (ClutterSeat *seat,
|
||||
XIGroupState group_state;
|
||||
|
||||
meta_clutter_x11_trap_x_errors ();
|
||||
XIQueryPointer (meta_clutter_x11_get_default_display (),
|
||||
XIQueryPointer (xdisplay,
|
||||
seat_x11->pointer_id,
|
||||
meta_backend_x11_get_xwindow (backend_x11),
|
||||
&root_ret, &child_ret,
|
||||
@ -1727,6 +1756,13 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass)
|
||||
seat_class->grab = meta_seat_x11_grab;
|
||||
seat_class->ungrab = meta_seat_x11_ungrab;
|
||||
|
||||
props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
"MetaBackend",
|
||||
"MetaBackend",
|
||||
META_TYPE_BACKEND,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
props[PROP_OPCODE] =
|
||||
g_param_spec_int ("opcode",
|
||||
"Opcode",
|
||||
@ -1768,15 +1804,21 @@ meta_seat_x11_init (MetaSeatX11 *seat)
|
||||
}
|
||||
|
||||
MetaSeatX11 *
|
||||
meta_seat_x11_new (int opcode,
|
||||
int logical_pointer,
|
||||
int logical_keyboard)
|
||||
meta_seat_x11_new (MetaBackend *backend,
|
||||
int opcode,
|
||||
int logical_pointer,
|
||||
int logical_keyboard)
|
||||
{
|
||||
return g_object_new (META_TYPE_SEAT_X11,
|
||||
"opcode", opcode,
|
||||
"pointer-id", logical_pointer,
|
||||
"keyboard-id", logical_keyboard,
|
||||
NULL);
|
||||
MetaSeatX11 *seat_x11;
|
||||
|
||||
seat_x11 = g_object_new (META_TYPE_SEAT_X11,
|
||||
"backend", backend,
|
||||
"opcode", opcode,
|
||||
"pointer-id", logical_pointer,
|
||||
"keyboard-id", logical_keyboard,
|
||||
NULL);
|
||||
|
||||
return seat_x11;
|
||||
}
|
||||
|
||||
static ClutterInputDevice *
|
||||
@ -1829,8 +1871,10 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
XEvent *xevent,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat);
|
||||
ClutterBackend *backend =
|
||||
meta_backend_get_clutter_backend (seat->backend);
|
||||
gboolean retval = FALSE;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
ClutterStage *stage = NULL;
|
||||
MetaStageX11 *stage_x11 = NULL;
|
||||
ClutterInputDevice *device, *source_device;
|
||||
@ -1892,7 +1936,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
if (device)
|
||||
{
|
||||
meta_input_device_x11_reset_axes (device);
|
||||
translate_device_classes (meta_clutter_x11_get_default_display (),
|
||||
translate_device_classes (xdisplay,
|
||||
device,
|
||||
xev->classes,
|
||||
xev->num_classes);
|
||||
@ -1991,10 +2035,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
if (clutter_input_device_get_device_type (source_device) == CLUTTER_PAD_DEVICE)
|
||||
{
|
||||
/* We got these events because of the passive button grab */
|
||||
XIAllowEvents (meta_clutter_x11_get_default_display (),
|
||||
xev->sourceid,
|
||||
XIAsyncDevice,
|
||||
xev->time);
|
||||
XIAllowEvents (xdisplay, xev->sourceid, XIAsyncDevice, xev->time);
|
||||
|
||||
event->any.stage = stage;
|
||||
|
||||
@ -2444,6 +2485,7 @@ void
|
||||
meta_seat_x11_select_stage_events (MetaSeatX11 *seat,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
Display *xdisplay = xdisplay_from_seat (seat);
|
||||
MetaStageX11 *stage_x11;
|
||||
XIEventMask xi_event_mask;
|
||||
unsigned char *mask;
|
||||
@ -2470,8 +2512,7 @@ meta_seat_x11_select_stage_events (MetaSeatX11 *seat,
|
||||
xi_event_mask.mask = mask;
|
||||
xi_event_mask.mask_len = len;
|
||||
|
||||
XISelectEvents (meta_clutter_x11_get_default_display (),
|
||||
stage_x11->xwin, &xi_event_mask, 1);
|
||||
XISelectEvents (xdisplay, stage_x11->xwin, &xi_event_mask, 1);
|
||||
|
||||
g_free (mask);
|
||||
}
|
||||
|
@ -26,9 +26,10 @@ G_BEGIN_DECLS
|
||||
#define META_TYPE_SEAT_X11 meta_seat_x11_get_type ()
|
||||
G_DECLARE_FINAL_TYPE (MetaSeatX11, meta_seat_x11, META, SEAT_X11, ClutterSeat)
|
||||
|
||||
MetaSeatX11 * meta_seat_x11_new (int opcode,
|
||||
int logical_pointer,
|
||||
int logical_keyboard);
|
||||
MetaSeatX11 * meta_seat_x11_new (MetaBackend *backend,
|
||||
int opcode,
|
||||
int logical_pointer,
|
||||
int logical_keyboard);
|
||||
gboolean meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
XEvent *xevent,
|
||||
ClutterEvent *event);
|
||||
|
Loading…
Reference in New Issue
Block a user