Disable XInput handling for keyboard events, re-enabling key press and

release events when pointer is outside window as well as re-enabling
keyrepeat.
* clutter/glx/clutter-stage-glx.c: (clutter_stage_glx_realize): select
for KeyPressMask and KeyReleaseMask even with XInput enabled.
* clutter/x11/clutter-backend-x11.c: (_clutter_x11_register_xinput): 
Disabled the XInput keyboard code paths (comments and #if 0's)
* clutter/x11/clutter-event-x11.c: (event_translate): always handle
keyboard events without regard to XInput.
This commit is contained in:
Øyvind Kolås 2008-06-30 14:01:03 +00:00
parent 9fa47035ac
commit 5525d0cad7
4 changed files with 44 additions and 16 deletions

View File

@ -1,8 +1,21 @@
2008-06-30 Øyvind Kolås <pippin@o-hand.com>
Disable XInput handling for keyboard events, re-enabling key press and
release events when pointer is outside window as well as re-enabling
keyrepeat.
* clutter/glx/clutter-stage-glx.c: (clutter_stage_glx_realize): select
for KeyPressMask and KeyReleaseMask even with XInput enabled.
* clutter/x11/clutter-backend-x11.c: (_clutter_x11_register_xinput):
Disabled the XInput keyboard code paths (comments and #if 0's)
* clutter/x11/clutter-event-x11.c: (event_translate): always handle
keyboard events without regard to XInput.
2008-06-29 Matthew Allum <mallum@openedhand.com> 2008-06-29 Matthew Allum <mallum@openedhand.com>
* clutter/x11/clutter-event-x11.c: * clutter/x11/clutter-event-x11.c:
ifdef convert_xdevicekey_to_xkey () with XINPUT check. ifdef convert_xdevicekey_to_xkey () with XINPUT check.
(fix via Andy Wingo) (fix via Andy Wingo)
2008-06-29 Tommi Komulainen <tommi.komulainen@iki.fi> 2008-06-29 Tommi Komulainen <tommi.komulainen@iki.fi>

View File

@ -188,6 +188,7 @@ clutter_stage_glx_realize (ClutterActor *actor)
StructureNotifyMask | StructureNotifyMask |
FocusChangeMask | FocusChangeMask |
ExposureMask | ExposureMask |
KeyPressMask | KeyReleaseMask |
PropertyChangeMask); PropertyChangeMask);
#ifdef USE_XINPUT #ifdef USE_XINPUT
_clutter_x11_select_events (stage_x11->xwin); _clutter_x11_select_events (stage_x11->xwin);

View File

@ -615,7 +615,7 @@ _clutter_x11_register_xinput ()
/* Only want 'raw' devices themselves not virtual ones */ /* Only want 'raw' devices themselves not virtual ones */
if (info->use == IsXExtensionPointer || if (info->use == IsXExtensionPointer ||
info->use == IsXExtensionKeyboard || /*info->use == IsXExtensionKeyboard || XInput is broken */
info->use == IsXExtensionDevice) info->use == IsXExtensionDevice)
{ {
clutter_x11_trap_x_errors (); clutter_x11_trap_x_errors ();
@ -645,9 +645,10 @@ _clutter_x11_register_xinput ()
device->type = CLUTTER_X11_XINPUT_POINTER_DEVICE; device->type = CLUTTER_X11_XINPUT_POINTER_DEVICE;
have_an_xpointer = TRUE; have_an_xpointer = TRUE;
break; break;
/* XInput is broken:
case IsXExtensionKeyboard: case IsXExtensionKeyboard:
device->type = CLUTTER_X11_XINPUT_KEYBOARD_DEVICE; device->type = CLUTTER_X11_XINPUT_KEYBOARD_DEVICE;
break; break;*/
case IsXExtensionDevice: case IsXExtensionDevice:
device->type = CLUTTER_X11_XINPUT_EXTENSION_DEVICE; device->type = CLUTTER_X11_XINPUT_EXTENSION_DEVICE;
break; break;
@ -667,6 +668,8 @@ _clutter_x11_register_xinput ()
switch (xclass_info->input_class) switch (xclass_info->input_class)
{ {
#if 0
/* We do not do XInput keyboard events yet, since it is broken */
case KeyClass: case KeyClass:
DeviceKeyPress (xdevice, DeviceKeyPress (xdevice,
x11b->event_types [CLUTTER_X11_XINPUT_KEY_PRESS_EVENT], x11b->event_types [CLUTTER_X11_XINPUT_KEY_PRESS_EVENT],
@ -678,6 +681,7 @@ _clutter_x11_register_xinput ()
device->xevent_list [num_events]); device->xevent_list [num_events]);
num_events++; num_events++;
break; break;
#endif
case ButtonClass: case ButtonClass:
DeviceButtonPress (xdevice, DeviceButtonPress (xdevice,

View File

@ -570,6 +570,18 @@ event_translate (ClutterBackend *backend,
} }
break; break;
case KeyPress:
event->key.type = event->type = CLUTTER_KEY_PRESS;
translate_key_event (backend, event, xevent);
set_user_time (backend_x11, &xwindow, xevent->xkey.time);
break;
case KeyRelease:
event->key.type = event->type = CLUTTER_KEY_RELEASE;
translate_key_event (backend, event, xevent);
break;
default: default:
/* ignore every other event */ /* ignore every other event */
not_yet_handled = TRUE; not_yet_handled = TRUE;
@ -584,18 +596,9 @@ event_translate (ClutterBackend *backend,
/* Regular X event */ /* Regular X event */
switch (xevent->type) switch (xevent->type)
{ {
case KeyPress: /* KeyPress / KeyRelease should reside here if XInput
event->key.type = event->type = CLUTTER_KEY_PRESS; * worked properly
translate_key_event (backend, event, xevent); */
set_user_time (backend_x11, &xwindow, xevent->xkey.time);
break;
case KeyRelease:
event->key.type = event->type = CLUTTER_KEY_RELEASE;
translate_key_event (backend, event, xevent);
break;
case ButtonPress: case ButtonPress:
switch (xevent->xbutton.button) switch (xevent->xbutton.button)
{ {
@ -761,6 +764,12 @@ event_translate (ClutterBackend *backend,
xmev->x, xmev->x,
xmev->y); xmev->y);
} }
#if 0
/* the Xinput handling of key presses/releases disabled for now since
* it makes keyrepeat, and key presses and releases outside the window
* not generate events even when the window has focus
*/
else if (xevent->type else if (xevent->type
== ev_types [CLUTTER_X11_XINPUT_KEY_PRESS_EVENT]) == ev_types [CLUTTER_X11_XINPUT_KEY_PRESS_EVENT])
{ {
@ -785,6 +794,7 @@ event_translate (ClutterBackend *backend,
event->key.type = event->type = CLUTTER_KEY_RELEASE; event->key.type = event->type = CLUTTER_KEY_RELEASE;
translate_key_event (backend, event, &xevent_converted); translate_key_event (backend, event, &xevent_converted);
} }
#endif
else else
#endif #endif
{ {