mirror of
https://github.com/brl/mutter.git
synced 2025-02-23 16:34:10 +00:00
settings: Add the :long-press-duration
A property to control the minimum time that has to elapse before a press is recognized as a long press. This will be used by ClutterClickAction, but it can be shared across touch-based gestures.
This commit is contained in:
parent
2b81d90dd7
commit
93207d08f8
@ -59,6 +59,8 @@ struct _ClutterSettings
|
|||||||
gint xft_antialias;
|
gint xft_antialias;
|
||||||
gchar *xft_hint_style;
|
gchar *xft_hint_style;
|
||||||
gchar *xft_rgba;
|
gchar *xft_rgba;
|
||||||
|
|
||||||
|
gint long_press_duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterSettingsClass
|
struct _ClutterSettingsClass
|
||||||
@ -85,6 +87,8 @@ enum
|
|||||||
PROP_FONT_HINT_STYLE,
|
PROP_FONT_HINT_STYLE,
|
||||||
PROP_FONT_RGBA,
|
PROP_FONT_RGBA,
|
||||||
|
|
||||||
|
PROP_LONG_PRESS_DURATION,
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -251,6 +255,10 @@ clutter_settings_set_property (GObject *gobject,
|
|||||||
settings_update_font_options (self);
|
settings_update_font_options (self);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_LONG_PRESS_DURATION:
|
||||||
|
self->long_press_duration = g_value_get_int (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -303,6 +311,10 @@ clutter_settings_get_property (GObject *gobject,
|
|||||||
g_value_set_string (value, self->xft_rgba);
|
g_value_set_string (value, self->xft_rgba);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_LONG_PRESS_DURATION:
|
||||||
|
g_value_set_int (value, self->long_press_duration);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -494,6 +506,24 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
|
|||||||
NULL,
|
NULL,
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterSettings:long-press-duration:
|
||||||
|
*
|
||||||
|
* Sets the minimum duration for a press to be recognized as a long press
|
||||||
|
* gesture. The duration is expressed in milliseconds.
|
||||||
|
*
|
||||||
|
* See also #ClutterClickAction:long-press-duration.
|
||||||
|
*
|
||||||
|
* Since: 1.8
|
||||||
|
*/
|
||||||
|
obj_props[PROP_LONG_PRESS_DURATION] =
|
||||||
|
g_param_spec_int ("long-press-duration",
|
||||||
|
P_("Long Press Duration"),
|
||||||
|
P_("The minimum duration for a long press gesture to be recognized"),
|
||||||
|
0, G_MAXINT,
|
||||||
|
500,
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
gobject_class->set_property = clutter_settings_set_property;
|
gobject_class->set_property = clutter_settings_set_property;
|
||||||
gobject_class->get_property = clutter_settings_get_property;
|
gobject_class->get_property = clutter_settings_get_property;
|
||||||
gobject_class->notify = clutter_settings_notify;
|
gobject_class->notify = clutter_settings_notify;
|
||||||
@ -517,6 +547,8 @@ clutter_settings_init (ClutterSettings *self)
|
|||||||
self->xft_hinting = -1;
|
self->xft_hinting = -1;
|
||||||
self->xft_hint_style = NULL;
|
self->xft_hint_style = NULL;
|
||||||
self->xft_rgba = NULL;
|
self->xft_rgba = NULL;
|
||||||
|
|
||||||
|
self->long_press_duration = 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user