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:
parent
5b1620475e
commit
dcba7c5044
@ -50,6 +50,7 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_BACKEND,
|
PROP_BACKEND,
|
||||||
|
PROP_TOUCH_MODE,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ clutter_seat_set_property (GObject *object,
|
|||||||
case PROP_BACKEND:
|
case PROP_BACKEND:
|
||||||
priv->backend = g_value_get_object (value);
|
priv->backend = g_value_get_object (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_TOUCH_MODE:
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
@ -103,6 +105,9 @@ clutter_seat_get_property (GObject *object,
|
|||||||
case PROP_BACKEND:
|
case PROP_BACKEND:
|
||||||
g_value_set_object (value, priv->backend);
|
g_value_set_object (value, priv->backend);
|
||||||
break;
|
break;
|
||||||
|
case PROP_TOUCH_MODE:
|
||||||
|
g_value_set_boolean (value, FALSE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
@ -277,6 +282,13 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
|||||||
CLUTTER_TYPE_BACKEND,
|
CLUTTER_TYPE_BACKEND,
|
||||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
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);
|
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);
|
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;
|
||||||
|
}
|
||||||
|
@ -174,5 +174,7 @@ CLUTTER_EXPORT
|
|||||||
void clutter_seat_warp_pointer (ClutterSeat *seat,
|
void clutter_seat_warp_pointer (ClutterSeat *seat,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
|
||||||
|
|
||||||
#endif /* CLUTTER_SEAT_H */
|
#endif /* CLUTTER_SEAT_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user