[mutter/wip/carlosg/input-thread: 119/130] clutter: Drop keycode_to_evdev vmethod
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-thread: 119/130] clutter: Drop keycode_to_evdev vmethod
- Date: Sat, 21 Nov 2020 18:41:53 +0000 (UTC)
commit eef27489efd6737376675b570799d60c78fa43b0
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Nov 19 12:21:26 2020 +0100
clutter: Drop keycode_to_evdev vmethod
This is just used in the native backend, move it to an utility
function there.
clutter/clutter/clutter-input-device-private.h | 5 ----
clutter/clutter/clutter-input-device.c | 34 ----------------------
clutter/clutter/clutter-input-device.h | 4 ---
src/backends/native/meta-input-device-native.c | 14 ---------
.../native/meta-virtual-input-device-native.c | 6 ++--
src/backends/native/meta-xkb-utils.c | 10 +++++++
src/backends/native/meta-xkb-utils.h | 1 +
src/backends/x11/meta-input-device-x11.c | 15 ----------
8 files changed, 13 insertions(+), 76 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-device-private.h b/clutter/clutter/clutter-input-device-private.h
index fc9f1742ed..841bdfd66d 100644
--- a/clutter/clutter/clutter-input-device-private.h
+++ b/clutter/clutter/clutter-input-device-private.h
@@ -114,9 +114,4 @@ CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
-CLUTTER_EXPORT
-gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
- guint hardware_keycode,
- guint *evdev_keycode);
-
#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index 4631a454f1..bdab32a5c7 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -813,40 +813,6 @@ _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
}
}
-/**
- * clutter_input_device_keycode_to_evdev:
- * @device: A #ClutterInputDevice
- * @hardware_keycode: The hardware keycode from a #ClutterKeyEvent
- * @evdev_keycode: The return location for the evdev keycode
- *
- * Translates a hardware keycode from a #ClutterKeyEvent to the
- * equivalent evdev keycode. Note that depending on the input backend
- * used by Clutter this function can fail if there is no obvious
- * mapping between the key codes. The hardware keycode can be taken
- * from the #ClutterKeyEvent.hardware_keycode member of #ClutterKeyEvent.
- *
- * Return value: %TRUE if the conversion succeeded, %FALSE otherwise.
- *
- * Since: 1.10
- */
-gboolean
-clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
- guint hardware_keycode,
- guint *evdev_keycode)
-{
- ClutterInputDeviceClass *device_class;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
-
- device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
- if (device_class->keycode_to_evdev == NULL)
- return FALSE;
- else
- return device_class->keycode_to_evdev (device,
- hardware_keycode,
- evdev_keycode);
-}
-
static void
on_grab_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)
diff --git a/clutter/clutter/clutter-input-device.h b/clutter/clutter/clutter-input-device.h
index 72870c2604..c2a2521cee 100644
--- a/clutter/clutter/clutter-input-device.h
+++ b/clutter/clutter/clutter-input-device.h
@@ -41,10 +41,6 @@ struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
- gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
- guint hardware_keycode,
- guint *evdev_keycode);
-
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
guint group,
guint button);
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index 7ab48e4806..ec571cff01 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -120,19 +120,6 @@ meta_input_device_native_get_property (GObject *object,
}
}
-static gboolean
-meta_input_device_native_keycode_to_evdev (ClutterInputDevice *device,
- uint32_t hardware_keycode,
- uint32_t *evdev_keycode)
-{
- /* The hardware keycodes from the evdev backend are almost evdev
- keycodes: we use the evdev keycode file, but xkb rules have an
- offset by 8. See the comment in _clutter_key_event_new_from_evdev()
- */
- *evdev_keycode = hardware_keycode - 8;
- return TRUE;
-}
-
static gboolean
meta_input_device_native_is_mode_switch_button (ClutterInputDevice *device,
uint32_t group,
@@ -1203,7 +1190,6 @@ meta_input_device_native_class_init (MetaInputDeviceNativeClass *klass)
object_class->set_property = meta_input_device_native_set_property;
object_class->get_property = meta_input_device_native_get_property;
- device_manager_class->keycode_to_evdev = meta_input_device_native_keycode_to_evdev;
device_manager_class->is_mode_switch_button = meta_input_device_native_is_mode_switch_button;
device_manager_class->get_group_n_modes = meta_input_device_native_get_group_n_modes;
device_manager_class->is_grouped = meta_input_device_native_is_grouped;
diff --git a/src/backends/native/meta-virtual-input-device-native.c
b/src/backends/native/meta-virtual-input-device-native.c
index 28542dc94e..9d19f10828 100644
--- a/src/backends/native/meta-virtual-input-device-native.c
+++ b/src/backends/native/meta-virtual-input-device-native.c
@@ -538,8 +538,7 @@ apply_level_modifiers (ClutterVirtualInputDevice *virtual_device,
&keycode, NULL))
return;
- clutter_input_device_keycode_to_evdev (virtual_evdev->impl_state->device,
- keycode, &evcode);
+ evcode = meta_xkb_keycode_to_evdev (keycode);
meta_topic (META_DEBUG_INPUT,
"Emitting virtual key-%s of modifier key 0x%x (device %p)",
@@ -576,8 +575,7 @@ notify_keyval (GTask *task)
goto out;
}
- clutter_input_device_keycode_to_evdev (virtual_evdev->impl_state->device,
- keycode, &evcode);
+ evcode = meta_xkb_keycode_to_evdev (keycode);
if (get_button_type (evcode) != EVDEV_BUTTON_TYPE_KEY)
{
diff --git a/src/backends/native/meta-xkb-utils.c b/src/backends/native/meta-xkb-utils.c
index eb2a832013..99cc59f039 100644
--- a/src/backends/native/meta-xkb-utils.c
+++ b/src/backends/native/meta-xkb-utils.c
@@ -118,3 +118,13 @@ meta_xkb_translate_modifiers (struct xkb_state *state,
return modifiers;
}
+
+uint32_t
+meta_xkb_keycode_to_evdev (uint32_t hardware_keycode)
+{
+ /* The hardware keycodes from the evdev backend are almost evdev
+ keycodes: we use the evdev keycode file, but xkb rules have an
+ offset by 8. See the comment in _clutter_key_event_new_from_evdev()
+ */
+ return hardware_keycode - 8;
+}
diff --git a/src/backends/native/meta-xkb-utils.h b/src/backends/native/meta-xkb-utils.h
index f0fa507ace..b34de1fba6 100644
--- a/src/backends/native/meta-xkb-utils.h
+++ b/src/backends/native/meta-xkb-utils.h
@@ -37,5 +37,6 @@ void meta_xkb_translate_state (ClutterEvent *event,
uint32_t button_state);
ClutterModifierType meta_xkb_translate_modifiers (struct xkb_state *state,
ClutterModifierType button_state);
+uint32_t meta_xkb_keycode_to_evdev (uint32_t hardware_keycode);
#endif /* META_XKB_UTILS_H */
diff --git a/src/backends/x11/meta-input-device-x11.c b/src/backends/x11/meta-input-device-x11.c
index 3d82cce501..545a3a3398 100644
--- a/src/backends/x11/meta-input-device-x11.c
+++ b/src/backends/x11/meta-input-device-x11.c
@@ -106,20 +106,6 @@ meta_input_device_x11_constructed (GObject *object)
#endif
}
-static gboolean
-meta_input_device_x11_keycode_to_evdev (ClutterInputDevice *device,
- uint32_t hardware_keycode,
- uint32_t *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 gboolean
meta_input_device_x11_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)
@@ -296,7 +282,6 @@ meta_input_device_x11_class_init (MetaInputDeviceX11Class *klass)
gobject_class->set_property = meta_input_device_x11_set_property;
gobject_class->get_property = meta_input_device_x11_get_property;
- device_class->keycode_to_evdev = meta_input_device_x11_keycode_to_evdev;
device_class->is_grouped = meta_input_device_x11_is_grouped;
device_class->get_group_n_modes = meta_input_device_x11_get_group_n_modes;
device_class->is_mode_switch_button = meta_input_device_x11_is_mode_switch_button;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]