mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
clutter/seat: Add seat name
This is similar to the existing seat-id that is part of MetaSeatNative, but meant to be passed to created input capture seats. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
This commit is contained in:
parent
e917b7de43
commit
a2bdce2c8e
@ -51,7 +51,10 @@ static guint signals[N_SIGNALS] = { 0 };
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_NAME,
|
||||
PROP_TOUCH_MODE,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
@ -65,6 +68,8 @@ struct _ClutterSeatPrivate
|
||||
|
||||
/* Pointer a11y */
|
||||
ClutterPointerA11ySettings pointer_a11y_settings;
|
||||
|
||||
char *name;
|
||||
};
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterSeat, clutter_seat, G_TYPE_OBJECT)
|
||||
@ -75,8 +80,14 @@ clutter_seat_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterSeat *seat = CLUTTER_SEAT (object);
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_NAME:
|
||||
priv->name = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_TOUCH_MODE:
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -89,11 +100,17 @@ clutter_seat_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterSeat *seat = CLUTTER_SEAT (object);
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TOUCH_MODE:
|
||||
g_value_set_boolean (value, FALSE);
|
||||
break;
|
||||
case PROP_NAME:
|
||||
g_value_set_string (value, priv->name);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@ -109,6 +126,17 @@ clutter_seat_constructed (GObject *object)
|
||||
CLUTTER_SEAT (object));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_finalize (GObject *object)
|
||||
{
|
||||
ClutterSeat *seat = CLUTTER_SEAT (object);
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_clear_pointer (&priv->name, g_free);
|
||||
|
||||
G_OBJECT_CLASS (clutter_seat_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
{
|
||||
@ -117,6 +145,7 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
object_class->set_property = clutter_seat_set_property;
|
||||
object_class->get_property = clutter_seat_get_property;
|
||||
object_class->constructed = clutter_seat_constructed;
|
||||
object_class->finalize = clutter_seat_finalize;
|
||||
|
||||
signals[DEVICE_ADDED] =
|
||||
g_signal_new (I_("device-added"),
|
||||
@ -274,6 +303,20 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* ClutterSeat::name:
|
||||
*
|
||||
* The name of the seat.
|
||||
**/
|
||||
props[PROP_NAME] =
|
||||
g_param_spec_string ("name",
|
||||
P_("Seat name"),
|
||||
P_("Seat name"),
|
||||
NULL,
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, props);
|
||||
}
|
||||
|
||||
@ -747,3 +790,11 @@ clutter_seat_ungrab (ClutterSeat *seat,
|
||||
if (seat_class->ungrab)
|
||||
return seat_class->ungrab (seat, time);
|
||||
}
|
||||
|
||||
const char *
|
||||
clutter_seat_get_name (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
return priv->name;
|
||||
}
|
||||
|
@ -172,4 +172,7 @@ gboolean clutter_seat_query_state (ClutterSeat *seat,
|
||||
graphene_point_t *coords,
|
||||
ClutterModifierType *modifiers);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const char * clutter_seat_get_name (ClutterSeat *seat);
|
||||
|
||||
#endif /* CLUTTER_SEAT_H */
|
||||
|
@ -155,6 +155,7 @@ meta_backend_native_create_default_seat (MetaBackend *backend,
|
||||
return CLUTTER_SEAT (g_object_new (META_TYPE_SEAT_NATIVE,
|
||||
"backend", backend,
|
||||
"seat-id", seat_id,
|
||||
"name", seat_id,
|
||||
"flags", flags,
|
||||
NULL));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user