| 1 |
/* |
| 2 |
* Clutter. |
| 3 |
* |
| 4 |
* An OpenGL based 'interactive canvas' library. |
| 5 |
* |
| 6 |
* Copyright © 2010, 2011 Intel Corp. |
| 7 |
* |
| 8 |
* This library is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU Lesser General Public |
| 10 |
* License as published by the Free Software Foundation; either |
| 11 |
* version 2 of the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This library is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
* Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public |
| 19 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
* |
| 21 |
* Author: Emmanuele Bassi <[email protected]> |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "config.h" |
| 25 |
|
| 26 |
#include "clutter-input-device-core-x11.h" |
| 27 |
|
| 28 |
#include "clutter-debug.h" |
| 29 |
#include "clutter-device-manager-private.h" |
| 30 |
#include "clutter-private.h" |
| 31 |
#include "clutter-stage-private.h" |
| 32 |
|
| 33 |
#include "clutter-backend-x11.h" |
| 34 |
#include "clutter-stage-x11.h" |
| 35 |
|
| 36 |
typedef struct _ClutterInputDeviceClass ClutterInputDeviceX11Class; |
| 37 |
|
| 38 |
/* a specific X11 input device */ |
| 39 |
struct _ClutterInputDeviceX11 |
| 40 |
{ |
| 41 |
ClutterInputDevice device; |
| 42 |
|
| 43 |
int min_keycode; |
| 44 |
int max_keycode; |
| 45 |
}; |
| 46 |
|
| 47 |
#define clutter_input_device_x11_get_type _clutter_input_device_x11_get_type |
| 48 |
|
| 49 |
G_DEFINE_TYPE (ClutterInputDeviceX11, |
| 50 |
clutter_input_device_x11, |
| 51 |
CLUTTER_TYPE_INPUT_DEVICE); |
| 52 |
|
| 53 |
static gboolean |
| 54 |
clutter_input_device_x11_keycode_to_evdev (ClutterInputDevice *device, |
| 55 |
guint hardware_keycode, |
| 56 |
guint *evdev_keycode) |
| 57 |
{ |
| 58 |
/* When using evdev under X11 the hardware keycodes are the evdev |
| 59 |
keycodes plus 8. I haven't been able to find any documentation to |
| 60 |
know what the +8 is for. FIXME: This should probably verify that |
| 61 |
X server is using evdev. */ |
| 62 |
*evdev_keycode = hardware_keycode - 8; |
| 63 |
|
| 64 |
return TRUE; |
| 65 |
} |
| 66 |
|
| 67 |
static void |
| 68 |
clutter_input_device_x11_class_init (ClutterInputDeviceX11Class *klass) |
| 69 |
{ |
| 70 |
ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass); |
| 71 |
|
| 72 |
device_class->keycode_to_evdev = clutter_input_device_x11_keycode_to_evdev; |
| 73 |
} |
| 74 |
|
| 75 |
static void |
| 76 |
clutter_input_device_x11_init (ClutterInputDeviceX11 *self) |
| 77 |
{ |
| 78 |
} |