mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
x11: Always assign a device to pointer and key events
Even when we are not using XInput we now have fallback devices; the X11 backend should always assign the default devices when translating the X events to Clutter events.
This commit is contained in:
parent
ca16446319
commit
157da20e86
@ -410,14 +410,15 @@ event_translate (ClutterBackend *backend,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
XEvent *xevent)
|
XEvent *xevent)
|
||||||
{
|
{
|
||||||
ClutterBackendX11 *backend_x11;
|
ClutterBackendX11 *backend_x11;
|
||||||
ClutterStageX11 *stage_x11;
|
ClutterStageX11 *stage_x11;
|
||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
ClutterStageWindow *impl;
|
ClutterStageWindow *impl;
|
||||||
gboolean res, not_yet_handled = FALSE;
|
gboolean res, not_yet_handled = FALSE;
|
||||||
Window xwindow, stage_xwindow;
|
Window xwindow, stage_xwindow;
|
||||||
|
ClutterDeviceManager *manager;
|
||||||
|
|
||||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||||
|
|
||||||
xwindow = xevent->xany.window;
|
xwindow = xevent->xany.window;
|
||||||
|
|
||||||
@ -458,9 +459,11 @@ event_translate (ClutterBackend *backend,
|
|||||||
if (stage == NULL)
|
if (stage == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
impl = _clutter_stage_get_window (stage);
|
manager = clutter_device_manager_get_default ();
|
||||||
stage_x11 = CLUTTER_STAGE_X11 (impl);
|
|
||||||
stage_xwindow = xwindow; /* clutter_x11_get_stage_window (stage); */
|
impl = _clutter_stage_get_window (stage);
|
||||||
|
stage_x11 = CLUTTER_STAGE_X11 (impl);
|
||||||
|
stage_xwindow = xwindow; /* clutter_x11_get_stage_window (stage); */
|
||||||
|
|
||||||
event->any.stage = stage;
|
event->any.stage = stage;
|
||||||
|
|
||||||
@ -621,6 +624,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
event->key.type = event->type = CLUTTER_KEY_PRESS;
|
event->key.type = event->type = CLUTTER_KEY_PRESS;
|
||||||
|
/* default key device if no XInput support is defined */
|
||||||
|
event->key.device = clutter_device_manager_get_device (manager, 1);
|
||||||
translate_key_event (backend, event, xevent);
|
translate_key_event (backend, event, xevent);
|
||||||
|
|
||||||
set_user_time (backend_x11, &xwindow, xevent->xkey.time);
|
set_user_time (backend_x11, &xwindow, xevent->xkey.time);
|
||||||
@ -654,6 +659,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event->key.type = event->type = CLUTTER_KEY_RELEASE;
|
event->key.type = event->type = CLUTTER_KEY_RELEASE;
|
||||||
|
/* default key device if no XInput support is defined */
|
||||||
|
event->key.device = clutter_device_manager_get_device (manager, 1);
|
||||||
translate_key_event (backend, event, xevent);
|
translate_key_event (backend, event, xevent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -696,6 +703,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
event->scroll.x = xevent->xbutton.x;
|
event->scroll.x = xevent->xbutton.x;
|
||||||
event->scroll.y = xevent->xbutton.y;
|
event->scroll.y = xevent->xbutton.y;
|
||||||
event->scroll.modifier_state = xevent->xbutton.state;
|
event->scroll.modifier_state = xevent->xbutton.state;
|
||||||
|
event->scroll.device =
|
||||||
|
clutter_device_manager_get_device (manager, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -705,6 +714,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
event->button.y = xevent->xbutton.y;
|
event->button.y = xevent->xbutton.y;
|
||||||
event->button.modifier_state = xevent->xbutton.state;
|
event->button.modifier_state = xevent->xbutton.state;
|
||||||
event->button.button = xevent->xbutton.button;
|
event->button.button = xevent->xbutton.button;
|
||||||
|
event->button.device =
|
||||||
|
clutter_device_manager_get_device (manager, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,6 +739,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
event->button.y = xevent->xbutton.y;
|
event->button.y = xevent->xbutton.y;
|
||||||
event->button.modifier_state = xevent->xbutton.state;
|
event->button.modifier_state = xevent->xbutton.state;
|
||||||
event->button.button = xevent->xbutton.button;
|
event->button.button = xevent->xbutton.button;
|
||||||
|
event->button.device =
|
||||||
|
clutter_device_manager_get_device (manager, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
@ -736,6 +749,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
event->motion.x = xevent->xmotion.x;
|
event->motion.x = xevent->xmotion.x;
|
||||||
event->motion.y = xevent->xmotion.y;
|
event->motion.y = xevent->xmotion.y;
|
||||||
event->motion.modifier_state = xevent->xmotion.state;
|
event->motion.modifier_state = xevent->xmotion.state;
|
||||||
|
event->motion.device =
|
||||||
|
clutter_device_manager_get_device (manager, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
@ -746,6 +761,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
event->motion.x = xevent->xcrossing.x;
|
event->motion.x = xevent->xcrossing.x;
|
||||||
event->motion.y = xevent->xcrossing.y;
|
event->motion.y = xevent->xcrossing.y;
|
||||||
event->motion.modifier_state = xevent->xcrossing.state;
|
event->motion.modifier_state = xevent->xcrossing.state;
|
||||||
|
event->motion.device =
|
||||||
|
clutter_device_manager_get_device (manager, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
@ -753,6 +770,8 @@ event_translate (ClutterBackend *backend,
|
|||||||
event->crossing.time = xevent->xcrossing.time;
|
event->crossing.time = xevent->xcrossing.time;
|
||||||
event->crossing.x = xevent->xcrossing.x;
|
event->crossing.x = xevent->xcrossing.x;
|
||||||
event->crossing.y = xevent->xcrossing.y;
|
event->crossing.y = xevent->xcrossing.y;
|
||||||
|
event->motion.device =
|
||||||
|
clutter_device_manager_get_device (manager, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user