clutter: cleanup/remove core input X11 backend

We don't use the core input X11 backend, remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/459
This commit is contained in:
Olivier Fourdan 2019-02-26 13:48:55 +01:00
parent 39e9e53871
commit f9e33a89fd
6 changed files with 1 additions and 761 deletions

View File

@ -293,10 +293,8 @@ clutter_backend_private_headers = [
if have_x11 if have_x11
clutter_x11_sources = [ clutter_x11_sources = [
'x11/clutter-backend-x11.c', 'x11/clutter-backend-x11.c',
'x11/clutter-device-manager-core-x11.c',
'x11/clutter-device-manager-xi2.c', 'x11/clutter-device-manager-xi2.c',
'x11/clutter-event-x11.c', 'x11/clutter-event-x11.c',
'x11/clutter-input-device-core-x11.c',
'x11/clutter-input-device-tool-xi2.c', 'x11/clutter-input-device-tool-xi2.c',
'x11/clutter-input-device-xi2.c', 'x11/clutter-input-device-xi2.c',
'x11/clutter-keymap-x11.c', 'x11/clutter-keymap-x11.c',
@ -319,9 +317,7 @@ if have_x11
clutter_x11_private_headers = [ clutter_x11_private_headers = [
'x11/clutter-backend-x11.h', 'x11/clutter-backend-x11.h',
'x11/clutter-device-manager-core-x11.h',
'x11/clutter-device-manager-xi2.h', 'x11/clutter-device-manager-xi2.h',
'x11/clutter-input-device-core-x11.h',
'x11/clutter-input-device-tool-xi2.h', 'x11/clutter-input-device-tool-xi2.h',
'x11/clutter-input-device-xi2.h', 'x11/clutter-input-device-xi2.h',
'x11/clutter-keymap-x11.h', 'x11/clutter-keymap-x11.h',

View File

@ -34,7 +34,6 @@
#include <errno.h> #include <errno.h>
#include "clutter-backend-x11.h" #include "clutter-backend-x11.h"
#include "clutter-device-manager-core-x11.h"
#include "clutter-device-manager-xi2.h" #include "clutter-device-manager-xi2.h"
#include "clutter-settings-x11.h" #include "clutter-settings-x11.h"
#include "clutter-stage-x11.h" #include "clutter-stage-x11.h"
@ -265,13 +264,8 @@ clutter_backend_x11_create_device_manager (ClutterBackendX11 *backend_x11)
if (backend_x11->device_manager == NULL) if (backend_x11->device_manager == NULL)
{ {
CLUTTER_NOTE (BACKEND, "Creating Core device manager"); g_critical ("XI2 extension is missing.");
backend_x11->has_xinput = FALSE; backend_x11->has_xinput = FALSE;
backend_x11->device_manager =
g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_X11,
"backend", backend_x11,
NULL);
backend_x11->xi_minor = -1; backend_x11->xi_minor = -1;
} }
@ -480,9 +474,6 @@ _clutter_backend_x11_events_init (ClutterBackend *backend)
backend_x11->event_source = source; backend_x11->event_source = source;
} }
/* create the device manager; we need this because we can effectively
* choose between core+XI1 and XI2 input events
*/
clutter_backend_x11_create_device_manager (backend_x11); clutter_backend_x11_create_device_manager (backend_x11);
/* register keymap; unless we create a generic Keymap object, I'm /* register keymap; unless we create a generic Keymap object, I'm

View File

@ -1,555 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2009, 2010, 2011 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#include "clutter-build-config.h"
#include "clutter-device-manager-core-x11.h"
#include "clutter-backend-x11.h"
#include "clutter-input-device-core-x11.h"
#include "clutter-stage-x11.h"
#include "clutter-virtual-input-device-x11.h"
#include "clutter-backend.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-event-translator.h"
#include "clutter-stage-private.h"
#include "clutter-private.h"
#include "clutter-xkb-a11y-x11.h"
enum
{
PROP_0,
PROP_EVENT_BASE,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
static void clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface);
#define clutter_device_manager_x11_get_type _clutter_device_manager_x11_get_type
G_DEFINE_TYPE_WITH_CODE (ClutterDeviceManagerX11,
clutter_device_manager_x11,
CLUTTER_TYPE_DEVICE_MANAGER,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_TRANSLATOR,
clutter_event_translator_iface_init));
static inline void
translate_key_event (ClutterBackendX11 *backend_x11,
ClutterDeviceManagerX11 *manager_x11,
ClutterEvent *event,
XEvent *xevent)
{
ClutterEventX11 *event_x11;
char buffer[256 + 1];
int n;
event->key.type = xevent->xany.type == KeyPress ? CLUTTER_KEY_PRESS
: CLUTTER_KEY_RELEASE;
event->key.time = xevent->xkey.time;
clutter_event_set_device (event, manager_x11->core_keyboard);
/* KeyEvents have platform specific data associated to them */
event_x11 = _clutter_event_x11_new ();
_clutter_event_set_platform_data (event, event_x11);
event->key.modifier_state = (ClutterModifierType) xevent->xkey.state;
event->key.hardware_keycode = xevent->xkey.keycode;
/* keyval is the key ignoring all modifiers ('1' vs. '!') */
event->key.keyval =
_clutter_keymap_x11_translate_key_state (backend_x11->keymap,
event->key.hardware_keycode,
&event->key.modifier_state,
NULL);
event_x11->key_group =
_clutter_keymap_x11_get_key_group (backend_x11->keymap,
event->key.modifier_state);
event_x11->key_is_modifier =
_clutter_keymap_x11_get_is_modifier (backend_x11->keymap,
event->key.hardware_keycode);
event_x11->num_lock_set =
clutter_keymap_get_num_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
event_x11->caps_lock_set =
clutter_keymap_get_caps_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
/* unicode_value is the printable representation */
n = XLookupString (&xevent->xkey, buffer, sizeof (buffer) - 1, NULL, NULL);
if (n != NoSymbol)
{
event->key.unicode_value = g_utf8_get_char_validated (buffer, n);
if ((event->key.unicode_value != (gunichar) -1) &&
(event->key.unicode_value != (gunichar) -2))
goto out;
}
else
event->key.unicode_value = (gunichar)'\0';
out:
CLUTTER_NOTE (EVENT,
"%s: win:0x%x, key: %12s (%d)",
event->any.type == CLUTTER_KEY_PRESS
? "key press "
: "key release",
(unsigned int) xevent->xkey.window,
event->key.keyval ? buffer : "(none)",
event->key.keyval);
return;
}
static ClutterTranslateReturn
clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *event)
{
ClutterDeviceManagerX11 *manager_x11;
ClutterBackendX11 *backend_x11;
ClutterStageX11 *stage_x11;
ClutterTranslateReturn res;
ClutterStage *stage;
XEvent *xevent;
manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (translator);
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
xevent = native;
stage = clutter_x11_get_stage_from_window (xevent->xany.window);
if (stage == NULL)
return CLUTTER_TRANSLATE_CONTINUE;
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return CLUTTER_TRANSLATE_CONTINUE;
stage_x11 = CLUTTER_STAGE_X11 (_clutter_stage_get_window (stage));
event->any.stage = stage;
res = CLUTTER_TRANSLATE_CONTINUE;
switch (xevent->type)
{
case KeyPress:
translate_key_event (backend_x11, manager_x11, event, xevent);
_clutter_stage_x11_set_user_time (stage_x11, xevent->xkey.time);
res = CLUTTER_TRANSLATE_QUEUE;
break;
case KeyRelease:
/* old-style X11 terminals require that even modern X11 send
* KeyPress/KeyRelease pairs when auto-repeating. for this
* reason modern(-ish) API like XKB has a way to detect
* auto-repeat and do a single KeyRelease at the end of a
* KeyPress sequence.
*
* this check emulates XKB's detectable auto-repeat; we peek
* the next event and check if it's a KeyPress for the same key
* and timestamp - and then ignore it if it matches the
* KeyRelease
*
* if we have XKB, and autorepeat is enabled, then this becomes
* a no-op
*/
if (!backend_x11->have_xkb_autorepeat && XPending (xevent->xkey.display))
{
XEvent next_event;
XPeekEvent (xevent->xkey.display, &next_event);
if (next_event.type == KeyPress &&
next_event.xkey.keycode == xevent->xkey.keycode &&
next_event.xkey.time == xevent->xkey.time)
{
res = CLUTTER_TRANSLATE_REMOVE;
break;
}
}
translate_key_event (backend_x11, manager_x11, event, xevent);
res = CLUTTER_TRANSLATE_QUEUE;
break;
case ButtonPress:
CLUTTER_NOTE (EVENT,
"button press: win: 0x%x, coords: %d, %d, button: %d",
(unsigned int) stage_x11->xwin,
xevent->xbutton.x,
xevent->xbutton.y,
xevent->xbutton.button);
switch (xevent->xbutton.button)
{
case 4: /* up */
case 5: /* down */
case 6: /* left */
case 7: /* right */
event->scroll.type = CLUTTER_SCROLL;
if (xevent->xbutton.button == 4)
event->scroll.direction = CLUTTER_SCROLL_UP;
else if (xevent->xbutton.button == 5)
event->scroll.direction = CLUTTER_SCROLL_DOWN;
else if (xevent->xbutton.button == 6)
event->scroll.direction = CLUTTER_SCROLL_LEFT;
else
event->scroll.direction = CLUTTER_SCROLL_RIGHT;
event->scroll.time = xevent->xbutton.time;
event->scroll.x = xevent->xbutton.x;
event->scroll.y = xevent->xbutton.y;
event->scroll.modifier_state = xevent->xbutton.state;
event->scroll.axes = NULL;
break;
default:
event->button.type = event->type = CLUTTER_BUTTON_PRESS;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.modifier_state = xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.axes = NULL;
break;
}
clutter_event_set_device (event, manager_x11->core_pointer);
_clutter_stage_x11_set_user_time (stage_x11, xevent->xbutton.time);
res = CLUTTER_TRANSLATE_QUEUE;
break;
case ButtonRelease:
CLUTTER_NOTE (EVENT,
"button press: win: 0x%x, coords: %d, %d, button: %d",
(unsigned int) stage_x11->xwin,
xevent->xbutton.x,
xevent->xbutton.y,
xevent->xbutton.button);
/* scroll events don't have a corresponding release */
if (xevent->xbutton.button == 4 ||
xevent->xbutton.button == 5 ||
xevent->xbutton.button == 6 ||
xevent->xbutton.button == 7)
{
res = CLUTTER_TRANSLATE_REMOVE;
break;
}
event->button.type = event->type = CLUTTER_BUTTON_RELEASE;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.modifier_state = xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.axes = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
res = CLUTTER_TRANSLATE_QUEUE;
break;
case MotionNotify:
CLUTTER_NOTE (EVENT,
"motion: win: 0x%x, coords: %d, %d",
(unsigned int) stage_x11->xwin,
xevent->xmotion.x,
xevent->xmotion.y);
event->motion.type = event->type = CLUTTER_MOTION;
event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y;
event->motion.modifier_state = xevent->xmotion.state;
event->motion.axes = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
res = CLUTTER_TRANSLATE_QUEUE;
break;
case EnterNotify:
CLUTTER_NOTE (EVENT, "Entering the stage (time:%u)",
(unsigned int) xevent->xcrossing.time);
event->crossing.type = CLUTTER_ENTER;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.source = CLUTTER_ACTOR (stage);
event->crossing.related = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
_clutter_input_device_set_stage (manager_x11->core_pointer, stage);
res = CLUTTER_TRANSLATE_QUEUE;
break;
case LeaveNotify:
if (manager_x11->core_pointer->stage == NULL)
{
CLUTTER_NOTE (EVENT, "Discarding LeaveNotify for "
"ButtonRelease event off-stage");
res = CLUTTER_TRANSLATE_REMOVE;
break;
}
/* we know that we are leaving the stage here */
CLUTTER_NOTE (EVENT, "Leaving the stage (time:%u)",
(unsigned int) xevent->xcrossing.time);
event->crossing.type = CLUTTER_LEAVE;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.source = CLUTTER_ACTOR (stage);
event->crossing.related = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
_clutter_input_device_set_stage (manager_x11->core_pointer, NULL);
res = CLUTTER_TRANSLATE_QUEUE;
break;
default:
break;
}
return res;
}
static void
clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface)
{
iface->translate_event = clutter_device_manager_x11_translate_event;
}
static void
clutter_device_manager_x11_constructed (GObject *gobject)
{
ClutterDeviceManagerX11 *manager_x11;
ClutterDeviceManager *manager;
ClutterBackendX11 *backend_x11;
manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (gobject);
manager = CLUTTER_DEVICE_MANAGER (gobject);
g_object_get (gobject, "backend", &backend_x11, NULL);
g_assert (backend_x11 != NULL);
manager_x11->core_pointer =
g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11,
"name", "Core Pointer",
"has-cursor", TRUE,
"device-type", CLUTTER_POINTER_DEVICE,
"device-manager", manager_x11,
"device-mode", CLUTTER_INPUT_MODE_MASTER,
"backend", backend_x11,
"enabled", TRUE,
NULL);
CLUTTER_NOTE (BACKEND, "Added core pointer device");
manager_x11->core_keyboard =
g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11,
"name", "Core Keyboard",
"has-cursor", FALSE,
"device-type", CLUTTER_KEYBOARD_DEVICE,
"device-manager", manager_x11,
"device-mode", CLUTTER_INPUT_MODE_MASTER,
"backend", backend_x11,
"enabled", TRUE,
NULL);
CLUTTER_NOTE (BACKEND, "Added core keyboard device");
/* associate core devices */
_clutter_input_device_set_associated_device (manager_x11->core_pointer,
manager_x11->core_keyboard);
_clutter_input_device_set_associated_device (manager_x11->core_keyboard,
manager_x11->core_pointer);
clutter_device_manager_x11_a11y_init (manager);
if (G_OBJECT_CLASS (clutter_device_manager_x11_parent_class)->constructed)
G_OBJECT_CLASS (clutter_device_manager_x11_parent_class)->constructed (gobject);
}
static void
clutter_device_manager_x11_add_device (ClutterDeviceManager *manager,
ClutterInputDevice *device)
{
ClutterDeviceManagerX11 *manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (manager);
manager_x11->devices = g_slist_prepend (manager_x11->devices, device);
g_hash_table_replace (manager_x11->devices_by_id,
GINT_TO_POINTER (device->id),
device);
/* blow the cache */
g_slist_free (manager_x11->all_devices);
manager_x11->all_devices = NULL;
}
static void
clutter_device_manager_x11_remove_device (ClutterDeviceManager *manager,
ClutterInputDevice *device)
{
ClutterDeviceManagerX11 *manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (manager);
g_hash_table_remove (manager_x11->devices_by_id,
GINT_TO_POINTER (device->id));
manager_x11->devices = g_slist_remove (manager_x11->devices, device);
/* blow the cache */
g_slist_free (manager_x11->all_devices);
manager_x11->all_devices = NULL;
}
static const GSList *
clutter_device_manager_x11_get_devices (ClutterDeviceManager *manager)
{
ClutterDeviceManagerX11 *manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (manager);
/* cache the devices list so that we can keep the core pointer
* and keyboard outside of the ManagerX11:devices list
*/
if (manager_x11->all_devices == NULL)
{
GSList *all_devices = manager_x11->devices;
all_devices = g_slist_prepend (all_devices, manager_x11->core_keyboard);
all_devices = g_slist_prepend (all_devices, manager_x11->core_pointer);
manager_x11->all_devices = all_devices;
}
return CLUTTER_DEVICE_MANAGER_X11 (manager)->all_devices;
}
static ClutterInputDevice *
clutter_device_manager_x11_get_core_device (ClutterDeviceManager *manager,
ClutterInputDeviceType type)
{
ClutterDeviceManagerX11 *manager_x11;
manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (manager);
switch (type)
{
case CLUTTER_POINTER_DEVICE:
return manager_x11->core_pointer;
case CLUTTER_KEYBOARD_DEVICE:
return manager_x11->core_keyboard;
default:
return NULL;
}
return NULL;
}
static ClutterInputDevice *
clutter_device_manager_x11_get_device (ClutterDeviceManager *manager,
gint id)
{
ClutterDeviceManagerX11 *manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (manager);
return g_hash_table_lookup (manager_x11->devices_by_id,
GINT_TO_POINTER (id));
}
static ClutterVirtualInputDevice *
clutter_device_manager_x11_create_virtual_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type)
{
return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_X11, NULL);
}
static ClutterVirtualDeviceType
clutter_device_manager_x11_get_supported_virtual_device_types (ClutterDeviceManager *device_manager)
{
return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD |
CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER);
}
static void
clutter_device_manager_x11_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManagerX11 *manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (gobject);
switch (prop_id)
{
case PROP_EVENT_BASE:
manager_x11->xi_event_base = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_device_manager_x11_class_init (ClutterDeviceManagerX11Class *klass)
{
ClutterDeviceManagerClass *manager_class;
GObjectClass *gobject_class;
obj_props[PROP_EVENT_BASE] =
g_param_spec_int ("event-base",
"Event Base",
"The first XI event",
-1, G_MAXINT,
-1,
CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->constructed = clutter_device_manager_x11_constructed;
gobject_class->set_property = clutter_device_manager_x11_set_property;
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
manager_class = CLUTTER_DEVICE_MANAGER_CLASS (klass);
manager_class->add_device = clutter_device_manager_x11_add_device;
manager_class->remove_device = clutter_device_manager_x11_remove_device;
manager_class->get_devices = clutter_device_manager_x11_get_devices;
manager_class->get_core_device = clutter_device_manager_x11_get_core_device;
manager_class->get_device = clutter_device_manager_x11_get_device;
manager_class->create_virtual_device = clutter_device_manager_x11_create_virtual_device;
manager_class->get_supported_virtual_device_types = clutter_device_manager_x11_get_supported_virtual_device_types;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_x11_apply_kbd_a11y_settings;
}
static void
clutter_device_manager_x11_init (ClutterDeviceManagerX11 *self)
{
self->devices_by_id = g_hash_table_new (NULL, NULL);
}

View File

@ -1,70 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2009, 2010, 2011 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_DEVICE_MANAGER_X11_H__
#define __CLUTTER_DEVICE_MANAGER_X11_H__
#include <clutter/clutter-device-manager.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_DEVICE_MANAGER_X11 (_clutter_device_manager_x11_get_type ())
#define CLUTTER_DEVICE_MANAGER_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER_X11, ClutterDeviceManagerX11))
#define CLUTTER_IS_DEVICE_MANAGER_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER_X11))
#define CLUTTER_DEVICE_MANAGER_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER_X11, ClutterDeviceManagerX11Class))
#define CLUTTER_IS_DEVICE_MANAGER_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER_X11))
#define CLUTTER_DEVICE_MANAGER_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER_X11, ClutterDeviceManagerX11Class))
typedef struct _ClutterDeviceManagerX11 ClutterDeviceManagerX11;
typedef struct _ClutterDeviceManagerX11Class ClutterDeviceManagerX11Class;
struct _ClutterDeviceManagerX11
{
ClutterDeviceManager parent_instance;
GHashTable *devices_by_id;
/* the list of transient devices */
GSList *devices;
/* the list of all devices, transient and core; this can be
* NULL-ified when adding or removing devices
*/
GSList *all_devices;
ClutterInputDevice *core_pointer;
ClutterInputDevice *core_keyboard;
int xi_event_base;
};
struct _ClutterDeviceManagerX11Class
{
ClutterDeviceManagerClass parent_class;
};
GType _clutter_device_manager_x11_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_X11_H__ */

View File

@ -1,78 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2010, 2011 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#include "clutter-build-config.h"
#include "clutter-input-device-core-x11.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-backend-x11.h"
#include "clutter-stage-x11.h"
typedef struct _ClutterInputDeviceClass ClutterInputDeviceX11Class;
/* a specific X11 input device */
struct _ClutterInputDeviceX11
{
ClutterInputDevice device;
int min_keycode;
int max_keycode;
};
#define clutter_input_device_x11_get_type _clutter_input_device_x11_get_type
G_DEFINE_TYPE (ClutterInputDeviceX11,
clutter_input_device_x11,
CLUTTER_TYPE_INPUT_DEVICE);
static gboolean
clutter_input_device_x11_keycode_to_evdev (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode)
{
/* When using evdev under X11 the hardware keycodes are the evdev
keycodes plus 8. I haven't been able to find any documentation to
know what the +8 is for. FIXME: This should probably verify that
X server is using evdev. */
*evdev_keycode = hardware_keycode - 8;
return TRUE;
}
static void
clutter_input_device_x11_class_init (ClutterInputDeviceX11Class *klass)
{
ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass);
device_class->keycode_to_evdev = clutter_input_device_x11_keycode_to_evdev;
}
static void
clutter_input_device_x11_init (ClutterInputDeviceX11 *self)
{
}

View File

@ -1,44 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2010, 2011 Intel Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_INPUT_DEVICE_X11_H__
#define __CLUTTER_INPUT_DEVICE_X11_H__
#include <clutter/clutter-input-device.h>
#include <X11/Xlib.h>
#include "clutter-stage-x11.h"
G_BEGIN_DECLS
#define CLUTTER_TYPE_INPUT_DEVICE_X11 (_clutter_input_device_x11_get_type ())
#define CLUTTER_INPUT_DEVICE_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE_X11, ClutterInputDeviceX11))
#define CLUTTER_IS_INPUT_DEVICE_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE_X11))
typedef struct _ClutterInputDeviceX11 ClutterInputDeviceX11;
GType _clutter_input_device_x11_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_X11_H__ */