[PATCH spice-gtk 2/3] widget: make set_keypress_delay a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

So the widget can call it without going through g_object_set().

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]