[Spice-devel] [PATCH spice-gtk 1/2] main: add spice_main_update_display()

Marc-André Lureau marcandre.lureau at gmail.com
Tue Apr 9 05:16:21 PDT 2013


Allow to change locally display resolution without sending to remote,
This is useful to keep local information without boring the remote
---
 gtk/channel-main.c      | 37 +++++++++++++++++++++++++++++++------
 gtk/channel-main.h      |  2 ++
 gtk/map-file            |  1 +
 gtk/spice-glib-sym-file |  1 +
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 11cd0f9..1585f1d 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2382,19 +2382,25 @@ gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap
 }
 
 /**
- * spice_main_set_display:
+ * spice_main_update_display:
  * @channel:
  * @id: display ID
  * @x: x position
  * @y: y position
  * @width: display width
  * @height: display height
+ * @update: if %TRUE, update guest resolution after 1sec.
  *
- * Notify the guest of screen resolution change. The notification is
- * sent 1 second later, if no further changes happen.
+ * Update the display @id resolution.
+ *
+ * If @update is %TRUE, the remote configuration will be updated too
+ * after 1 second without further changes. You can send when you want
+ * without delay the new configuration to the remote with
+ * spice_main_send_monitor_config()
  **/
-void spice_main_set_display(SpiceMainChannel *channel, int id,
-                            int x, int y, int width, int height)
+void spice_main_update_display(SpiceMainChannel *channel, int id,
+                               int x, int y, int width, int height,
+                               gboolean update)
 {
     SpiceMainChannelPrivate *c;
 
@@ -2414,7 +2420,26 @@ void spice_main_set_display(SpiceMainChannel *channel, int id,
     c->display[id].width  = width;
     c->display[id].height = height;
 
-    update_display_timer(channel, 1);
+    if (update)
+        update_display_timer(channel, 1);
+}
+
+/**
+ * spice_main_set_display:
+ * @channel:
+ * @id: display ID
+ * @x: x position
+ * @y: y position
+ * @width: display width
+ * @height: display height
+ *
+ * Notify the guest of screen resolution change. The notification is
+ * sent 1 second later, if no further changes happen.
+ **/
+void spice_main_set_display(SpiceMainChannel *channel, int id,
+                            int x, int y, int width, int height)
+{
+    spice_main_update_display(channel, id, x, y, width, height, TRUE);
 }
 
 /**
diff --git a/gtk/channel-main.h b/gtk/channel-main.h
index adba0a2..3e4fc42 100644
--- a/gtk/channel-main.h
+++ b/gtk/channel-main.h
@@ -69,6 +69,8 @@ GType spice_main_channel_get_type(void);
 
 void spice_main_set_display(SpiceMainChannel *channel, int id,
                             int x, int y, int width, int height);
+void spice_main_update_display(SpiceMainChannel *channel, int id,
+                               int x, int y, int width, int height, gboolean update);
 void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled);
 gboolean spice_main_send_monitor_config(SpiceMainChannel *channel);
 
diff --git a/gtk/map-file b/gtk/map-file
index 4d05597..386afb1 100644
--- a/gtk/map-file
+++ b/gtk/map-file
@@ -69,6 +69,7 @@ spice_main_clipboard_selection_request;
 spice_main_send_monitor_config;
 spice_main_set_display;
 spice_main_set_display_enabled;
+spice_main_update_display;
 spice_playback_channel_get_type;
 spice_playback_channel_set_delay;
 spice_port_channel_get_type;
diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file
index 28b54af..ac8ee82 100644
--- a/gtk/spice-glib-sym-file
+++ b/gtk/spice-glib-sym-file
@@ -45,6 +45,7 @@ spice_main_clipboard_selection_request
 spice_main_send_monitor_config
 spice_main_set_display
 spice_main_set_display_enabled
+spice_main_update_display
 spice_playback_channel_get_type
 spice_playback_channel_set_delay
 spice_port_channel_get_type
-- 
1.8.1.1.439.g50a6b54



More information about the Spice-devel mailing list