[Spice-devel] [PATCH spice-gtk 2/3] widget: make set_keypress_delay a function
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Fri Aug 26 14:47:20 UTC 2016
From: Marc-André Lureau <marcandre.lureau at redhat.com>
So the widget can call it without going through g_object_set().
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/spice-widget.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/spice-widget.c b/src/spice-widget.c
index f288c28..46e0e49 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -329,6 +329,22 @@ whole:
set_monitor_ready(display, true);
}
+static void
+spice_display_set_keypress_delay(SpiceDisplay *display, guint delay)
+{
+ SpiceDisplayPrivate *d = display->priv;
+ const gchar *env = g_getenv("SPICE_KEYPRESS_DELAY");
+
+ if (env != NULL)
+ delay = strtoul(env, NULL, 10);
+
+ if (d->keypress_delay != delay) {
+ SPICE_DEBUG("keypress-delay is set to %u ms", delay);
+ d->keypress_delay = delay;
+ g_object_notify(G_OBJECT(display), "keypress-delay");
+ }
+}
+
static void spice_display_set_property(GObject *object,
guint prop_id,
const GValue *value,
@@ -386,15 +402,7 @@ static void spice_display_set_property(GObject *object,
scaling_updated(display);
break;
case PROP_KEYPRESS_DELAY:
- {
- const gchar *env = g_getenv("SPICE_KEYPRESS_DELAY");
- guint delay = g_value_get_uint(value);
- if (env != NULL)
- delay = strtoul(env, NULL, 10);
-
- SPICE_DEBUG("keypress-delay is set to %u ms", delay);
- d->keypress_delay = delay;
- }
+ spice_display_set_keypress_delay(display, g_value_get_uint(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
--
2.9.0
More information about the Spice-devel
mailing list