[Spice-devel] [PATCH spice-gtk 4/5] widget: add keypress-delay property
Marc-André Lureau
marcandre.lureau at gmail.com
Wed Aug 15 12:59:29 PDT 2012
The delay before the press event is sent to the server if the key is
kept pressed. If the key is released within that time, that delay is
ignored and a single key-press-release event will be sent.
---
gtk/spice-widget-priv.h | 1 +
gtk/spice-widget.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h
index 87cf34e..97c6489 100644
--- a/gtk/spice-widget-priv.h
+++ b/gtk/spice-widget-priv.h
@@ -112,6 +112,7 @@ struct _SpiceDisplayPrivate {
#ifdef WIN32
HHOOK keyboard_hook;
#endif
+ guint keypress_delay;
gint zoom_level;
};
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index a3369d5..8cb7abb 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -103,6 +103,7 @@ enum {
PROP_DISABLE_INPUTS,
PROP_ZOOM_LEVEL,
PROP_MONITOR_ID,
+ PROP_KEYPRESS_DELAY,
PROP_READY
};
@@ -179,6 +180,9 @@ static void spice_display_get_property(GObject *object,
case PROP_READY:
g_value_set_boolean(value, d->ready);
break;
+ case PROP_KEYPRESS_DELAY:
+ g_value_set_uint(value, d->keypress_delay);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -347,6 +351,9 @@ static void spice_display_set_property(GObject *object,
d->zoom_level = g_value_get_int(value);
scaling_updated(display);
break;
+ case PROP_KEYPRESS_DELAY:
+ d->keypress_delay = g_value_get_uint(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -1561,6 +1568,26 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
G_PARAM_STATIC_STRINGS));
/**
+ * SpiceDisplay:keypress-delay:
+ *
+ * Delay in ms of non-modifiers key press events. If the key is
+ * released before this delay, a single press & release event is
+ * sent to the server. If the key is pressed longer than the
+ * keypress-delay, the server will receive the delayed press
+ * event, and a following release event when the key is released.
+ *
+ * Since: 0.13
+ **/
+ g_object_class_install_property
+ (gobject_class, PROP_KEYPRESS_DELAY,
+ g_param_spec_uint("keypress-delay", "Keypress delay",
+ "Keypress delay",
+ 0, G_MAXUINT, 100,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
* SpiceDisplay:disable-inputs:
*
* Disable all keyboard & mouse inputs.
--
1.7.10.4
More information about the Spice-devel
mailing list