mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
clutter: Add function to find out the number of modes for a pad group
This is obtained in backend-dependent ways in the upper layers, seems better to let ClutterInputDevice provide this information. https://bugzilla.gnome.org/show_bug.cgi?id=771098
This commit is contained in:
parent
9d38ffa6e3
commit
d6fc41b73e
@ -158,6 +158,8 @@ struct _ClutterInputDeviceClass
|
|||||||
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
|
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
|
||||||
guint group,
|
guint group,
|
||||||
guint button);
|
guint button);
|
||||||
|
gint (* get_group_n_modes) (ClutterInputDevice *device,
|
||||||
|
gint group);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Platform-dependent interface */
|
/* Platform-dependent interface */
|
||||||
|
@ -2175,6 +2175,25 @@ clutter_input_device_get_n_mode_groups (ClutterInputDevice *device)
|
|||||||
return device->n_mode_groups;
|
return device->n_mode_groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
clutter_input_device_get_group_n_modes (ClutterInputDevice *device,
|
||||||
|
gint group)
|
||||||
|
{
|
||||||
|
ClutterInputDeviceClass *device_class;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
||||||
|
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
|
||||||
|
CLUTTER_PAD_DEVICE, 0);
|
||||||
|
g_return_val_if_fail (group >= 0, 0);
|
||||||
|
|
||||||
|
device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
|
||||||
|
|
||||||
|
if (device_class->get_group_n_modes)
|
||||||
|
return device_class->get_group_n_modes (device, group);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
|
clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
|
||||||
guint group,
|
guint group,
|
||||||
|
@ -147,6 +147,10 @@ gint clutter_input_device_get_n_strips (ClutterInputDev
|
|||||||
CLUTTER_AVAILABLE_IN_ALL
|
CLUTTER_AVAILABLE_IN_ALL
|
||||||
gint clutter_input_device_get_n_mode_groups (ClutterInputDevice *device);
|
gint clutter_input_device_get_n_mode_groups (ClutterInputDevice *device);
|
||||||
|
|
||||||
|
CLUTTER_AVAILABLE_IN_ALL
|
||||||
|
gint clutter_input_device_get_group_n_modes (ClutterInputDevice *device,
|
||||||
|
gint group);
|
||||||
|
|
||||||
CLUTTER_AVAILABLE_IN_ALL
|
CLUTTER_AVAILABLE_IN_ALL
|
||||||
gboolean clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
|
gboolean clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
|
||||||
guint group,
|
guint group,
|
||||||
|
@ -180,6 +180,19 @@ clutter_input_device_evdev_is_mode_switch_button (ClutterInputDevice *device,
|
|||||||
return libinput_tablet_pad_mode_group_button_is_toggle (mode_group, button) != 0;
|
return libinput_tablet_pad_mode_group_button_is_toggle (mode_group, button) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
clutter_input_device_evdev_get_group_n_modes (ClutterInputDevice *device,
|
||||||
|
gint group)
|
||||||
|
{
|
||||||
|
struct libinput_device *libinput_device;
|
||||||
|
struct libinput_tablet_pad_mode_group *mode_group;
|
||||||
|
|
||||||
|
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
|
||||||
|
mode_group = libinput_device_tablet_pad_get_mode_group (libinput_device, group);
|
||||||
|
|
||||||
|
return libinput_tablet_pad_mode_group_get_num_modes (mode_group);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass)
|
clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass)
|
||||||
{
|
{
|
||||||
@ -192,6 +205,7 @@ clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass)
|
|||||||
klass->keycode_to_evdev = clutter_input_device_evdev_keycode_to_evdev;
|
klass->keycode_to_evdev = clutter_input_device_evdev_keycode_to_evdev;
|
||||||
klass->update_from_tool = clutter_input_device_evdev_update_from_tool;
|
klass->update_from_tool = clutter_input_device_evdev_update_from_tool;
|
||||||
klass->is_mode_switch_button = clutter_input_device_evdev_is_mode_switch_button;
|
klass->is_mode_switch_button = clutter_input_device_evdev_is_mode_switch_button;
|
||||||
|
klass->get_group_n_modes = clutter_input_device_evdev_get_group_n_modes;
|
||||||
|
|
||||||
obj_props[PROP_DEVICE_MATRIX] =
|
obj_props[PROP_DEVICE_MATRIX] =
|
||||||
g_param_spec_boxed ("device-matrix",
|
g_param_spec_boxed ("device-matrix",
|
||||||
|
Loading…
Reference in New Issue
Block a user