x11: Do not try to access private structures

ClutterInputDeviceX11 has been made private, so we cannot access it from
outside of clutter-input-device-core-x11.c. We should have simple
accessors for the min/max keycode, which is the only detail that we use.
This commit is contained in:
Emmanuele Bassi 2011-12-01 13:41:45 +00:00
parent 67cdbbaf51
commit 1dc7c45438
3 changed files with 32 additions and 4 deletions

View File

@ -97,8 +97,9 @@ translate_class_info (ClutterInputDevice *device,
n_keys = xk_info->max_keycode - xk_info->min_keycode + 1; n_keys = xk_info->max_keycode - xk_info->min_keycode + 1;
_clutter_input_device_set_n_keys (device, n_keys); _clutter_input_device_set_n_keys (device, n_keys);
device_x11->min_keycode = xk_info->min_keycode; _clutter_input_device_x11_set_keycodes (device_x11,
device_x11->max_keycode = xk_info->max_keycode; xk_info->min_keycode,
xk_info->max_keycode);
} }
break; break;

View File

@ -62,8 +62,8 @@ struct _ClutterInputDeviceX11
gint *axis_data; gint *axis_data;
gint min_keycode; int min_keycode;
gint max_keycode; int max_keycode;
}; };
#define clutter_input_device_x11_get_type _clutter_input_device_x11_get_type #define clutter_input_device_x11_get_type _clutter_input_device_x11_get_type
@ -217,6 +217,27 @@ clutter_input_device_x11_init (ClutterInputDeviceX11 *self)
{ {
} }
void
_clutter_input_device_x11_set_keycodes (ClutterInputDeviceX11 *device_x11,
int min_keycode,
int max_keycode)
{
device_x11->min_keycode = min_keycode;
device_x11->max_keycode = max_keycode;
}
int
_clutter_input_device_x11_get_min_keycode (ClutterInputDeviceX11 *device_x11)
{
return device_x11->min_keycode;
}
int
_clutter_input_device_x11_get_max_keycode (ClutterInputDeviceX11 *device_x11)
{
return device_x11->max_keycode;
}
#ifdef HAVE_XINPUT #ifdef HAVE_XINPUT
static void static void
update_axes (ClutterInputDeviceX11 *device_x11, update_axes (ClutterInputDeviceX11 *device_x11,

View File

@ -39,6 +39,12 @@ typedef struct _ClutterInputDeviceX11 ClutterInputDeviceX11;
GType _clutter_input_device_x11_get_type (void) G_GNUC_CONST; GType _clutter_input_device_x11_get_type (void) G_GNUC_CONST;
void _clutter_input_device_x11_set_keycodes (ClutterInputDeviceX11 *device_x11,
int min_keycode,
int max_keycode);
int _clutter_input_device_x11_get_min_keycode (ClutterInputDeviceX11 *device_x11);
int _clutter_input_device_x11_get_max_keycode (ClutterInputDeviceX11 *device_x11);
gboolean _clutter_input_device_x11_translate_xi_event (ClutterInputDeviceX11 *device_x11, gboolean _clutter_input_device_x11_translate_xi_event (ClutterInputDeviceX11 *device_x11,
ClutterStageX11 *stage_x11, ClutterStageX11 *stage_x11,
XEvent *xevent, XEvent *xevent,