backends: Move absolute/relative device mapping to native backend

This is a bit scattered around, with the setter/getter in Clutter, and
it only being only directly honored in Wayland (it goes straight through
device properties in X11).

Make this private native API, and out of public ClutterInputDevice API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
This commit is contained in:
Carlos Garnacho
2020-05-06 19:06:59 +02:00
committed by Jonas Ådahl
parent 82c6c3f303
commit 6cb1557d99
9 changed files with 55 additions and 87 deletions

View File

@ -1635,12 +1635,6 @@ typedef enum
CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
} ClutterInputDevicePadSource;
typedef enum
{
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE,
} ClutterInputDeviceMapping;
typedef enum
{
CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,

View File

@ -157,8 +157,6 @@ struct _ClutterInputDevice
int n_strips;
int n_mode_groups;
ClutterInputDeviceMapping mapping_mode;
guint has_cursor : 1;
guint is_enabled : 1;

View File

@ -72,7 +72,6 @@ enum
PROP_N_RINGS,
PROP_N_MODE_GROUPS,
PROP_DEVICE_NODE,
PROP_MAPPING_MODE,
PROP_LAST
};
@ -219,10 +218,6 @@ clutter_input_device_set_property (GObject *gobject,
self->node_path = g_value_dup_string (value);
break;
case PROP_MAPPING_MODE:
self->mapping_mode = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -299,10 +294,6 @@ clutter_input_device_get_property (GObject *gobject,
g_value_set_string (value, self->node_path);
break;
case PROP_MAPPING_MODE:
g_value_set_enum (value, self->mapping_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -506,14 +497,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
NULL,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
obj_props[PROP_MAPPING_MODE] =
g_param_spec_enum ("mapping-mode",
P_("Device mapping mode"),
P_("Device mapping mode"),
CLUTTER_TYPE_INPUT_DEVICE_MAPPING,
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
CLUTTER_PARAM_READWRITE);
gobject_class->dispose = clutter_input_device_dispose;
gobject_class->set_property = clutter_input_device_set_property;
gobject_class->get_property = clutter_input_device_get_property;
@ -2391,43 +2374,6 @@ clutter_input_device_get_device_node (ClutterInputDevice *device)
return device->node_path;
}
ClutterInputDeviceMapping
clutter_input_device_get_mapping_mode (ClutterInputDevice *device)
{
ClutterInputDeviceType device_type;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
device_type = clutter_input_device_get_device_type (device);
g_return_val_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE,
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
return device->mapping_mode;
}
void
clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
ClutterInputDeviceMapping mapping)
{
ClutterInputDeviceType device_type;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
device_type = clutter_input_device_get_device_type (device);
g_return_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE);
if (device->mapping_mode == mapping)
return;
device->mapping_mode = mapping;
g_object_notify (G_OBJECT (device), "mapping-mode");
}
gboolean
clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)

View File

@ -178,12 +178,6 @@ gint clutter_input_device_get_mode_switch_button_group (Clutt
CLUTTER_EXPORT
const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
CLUTTER_EXPORT
ClutterInputDeviceMapping clutter_input_device_get_mapping_mode (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
ClutterInputDeviceMapping mapping);
CLUTTER_EXPORT
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device);