[mutter/wip/carlosg/dispose-libinput-device: 1/4] backends/native: Make mode switch checks libinput independent
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/dispose-libinput-device: 1/4] backends/native: Make mode switch checks libinput independent
- Date: Tue, 15 Dec 2020 23:26:54 +0000 (UTC)
commit c7788b334b68036c95aa99dcce8a28e006d1bd23
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Dec 15 23:47:08 2020 +0100
backends/native: Make mode switch checks libinput independent
Add this info to the PadFeatures array, and pull it from there.
src/backends/native/meta-input-device-native.c | 27 ++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index 2878675f23..808135a8da 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -56,6 +56,7 @@ struct _PadFeature
ClutterInputDevicePadFeature feature;
int n_feature;
int group;
+ gboolean mode_switch;
};
static void clear_slow_keys (MetaInputDeviceNative *device);
@@ -133,13 +134,25 @@ meta_input_device_native_is_mode_switch_button (ClutterInputDevice *device,
uint32_t group,
uint32_t button)
{
- struct libinput_device *libinput_device;
- struct libinput_tablet_pad_mode_group *mode_group;
+ MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
+ int i;
- libinput_device = meta_input_device_native_get_libinput_device (device);
- mode_group = libinput_device_tablet_pad_get_mode_group (libinput_device, group);
+ if (!device_native->pad_features)
+ return FALSE;
- return libinput_tablet_pad_mode_group_button_is_toggle (mode_group, button) != 0;
+ for (i = 0; i < device_native->pad_features->len; i++)
+ {
+ PadFeature *pad_feature;
+
+ pad_feature = &g_array_index (device_native->pad_features, PadFeature, i);
+
+ if (pad_feature->feature == CLUTTER_PAD_FEATURE_BUTTON &&
+ pad_feature->group == group &&
+ pad_feature->n_feature == button)
+ return pad_feature->mode_switch;
+ }
+
+ return FALSE;
}
static int
@@ -1288,7 +1301,9 @@ update_pad_features (MetaInputDeviceNative *device_native)
for (j = 0; j < n_buttons; j++)
{
- PadFeature feature = { CLUTTER_PAD_FEATURE_BUTTON, j, i };
+ gboolean is_mode_switch =
+ libinput_tablet_pad_mode_group_button_is_toggle (mode_group, j) != 0;
+ PadFeature feature = { CLUTTER_PAD_FEATURE_BUTTON, j, i, is_mode_switch };
if (libinput_tablet_pad_mode_group_has_button (mode_group, j))
g_array_append_val (device_native->pad_features, feature);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]