1
0
Fork 0

clutter: Add ClutterSeat::touch-mode boolean property

And the corresponding getter. This property returns FALSE by default
and must be overridden by subclasses. This will allow gnome-shell to
hook up specific behavior that should not happen on mouse+keyboard
setups.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1044
This commit is contained in:
Carlos Garnacho 2020-02-10 19:57:38 +01:00 committed by Carlos Garnacho
parent 5b1620475e
commit dcba7c5044
2 changed files with 26 additions and 0 deletions

View file

@ -50,6 +50,7 @@ enum
{
PROP_0,
PROP_BACKEND,
PROP_TOUCH_MODE,
N_PROPS
};
@ -84,6 +85,7 @@ clutter_seat_set_property (GObject *object,
case PROP_BACKEND:
priv->backend = g_value_get_object (value);
break;
case PROP_TOUCH_MODE:
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -103,6 +105,9 @@ clutter_seat_get_property (GObject *object,
case PROP_BACKEND:
g_value_set_object (value, priv->backend);
break;
case PROP_TOUCH_MODE:
g_value_set_boolean (value, FALSE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -277,6 +282,13 @@ clutter_seat_class_init (ClutterSeatClass *klass)
CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
props[PROP_TOUCH_MODE] =
g_param_spec_boolean ("touch-mode",
P_("Touch mode"),
P_("Touch mode"),
FALSE,
CLUTTER_PARAM_READABLE);
g_object_class_install_properties (object_class, N_PROPS, props);
}
@ -556,3 +568,15 @@ clutter_seat_warp_pointer (ClutterSeat *seat,
CLUTTER_SEAT_GET_CLASS (seat)->warp_pointer (seat, x, y);
}
gboolean
clutter_seat_get_touch_mode (ClutterSeat *seat)
{
gboolean touch_mode;
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
g_object_get (G_OBJECT (seat), "touch-mode", &touch_mode, NULL);
return touch_mode;
}

View file

@ -174,5 +174,7 @@ CLUTTER_EXPORT
void clutter_seat_warp_pointer (ClutterSeat *seat,
int x,
int y);
CLUTTER_EXPORT
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
#endif /* CLUTTER_SEAT_H */