[Spice-devel] [PATCH spice-gtk 07/25] display: add readonly monitors property

Marc-André Lureau marcandre.lureau at gmail.com
Thu Jul 12 15:29:04 PDT 2012


---
 gtk/channel-display.c |   27 +++++++++++++++++++++++++++
 gtk/channel-display.h |   10 ++++++++++
 2 files changed, 37 insertions(+)

diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 952628c..681482b 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -70,6 +70,7 @@ struct _SpiceDisplayChannelPrivate {
     int                         nstreams;
     gboolean                    mark;
     guint                       mark_false_event_id;
+    GArray                      *monitors;
 #ifdef WIN32
     HDC dc;
 #endif
@@ -82,6 +83,7 @@ enum {
     PROP_0,
     PROP_WIDTH,
     PROP_HEIGHT,
+    PROP_MONITORS
 };
 
 enum {
@@ -123,6 +125,9 @@ static void spice_display_channel_dispose(GObject *object)
 
 static void spice_display_channel_finalize(GObject *object)
 {
+    SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(object)->priv;
+
+    g_clear_pointer(&c->monitors, g_array_unref);
     clear_surfaces(SPICE_CHANNEL(object), FALSE);
     clear_streams(SPICE_CHANNEL(object));
 
@@ -142,6 +147,8 @@ static void spice_display_channel_constructed(GObject *object)
     g_return_if_fail(c->images != NULL);
     g_return_if_fail(c->palettes != NULL);
 
+    c->monitors = g_array_new(FALSE, TRUE, sizeof(SpiceDisplayMonitorConfig));
+
     if (G_OBJECT_CLASS(spice_display_channel_parent_class)->constructed)
         G_OBJECT_CLASS(spice_display_channel_parent_class)->constructed(object);
 }
@@ -165,6 +172,10 @@ static void spice_display_get_property(GObject    *object,
         g_value_set_uint(value, surface ? surface->height : 0);
         break;
     }
+    case PROP_MONITORS: {
+        g_value_set_boxed(value, c->monitors);
+        break;
+    }
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -228,6 +239,22 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass)
                            G_PARAM_STATIC_STRINGS));
 
     /**
+     * SpiceDisplayChannel:monitors:
+     *
+     * Current monitors configuration.
+     *
+     * Since: 0.13
+     */
+    g_object_class_install_property
+        (gobject_class, PROP_MONITORS,
+         g_param_spec_boxed("monitors",
+                            "Display monitors",
+                            "The monitors configuration",
+                            G_TYPE_ARRAY,
+                            G_PARAM_READABLE |
+                            G_PARAM_STATIC_STRINGS));
+
+    /**
      * SpiceDisplayChannel::display-primary-create:
      * @display: the #SpiceDisplayChannel that emitted the signal
      * @format: %SPICE_SURFACE_FMT_32_xRGB or %SPICE_SURFACE_FMT_16_555;
diff --git a/gtk/channel-display.h b/gtk/channel-display.h
index b8d7679..a31aa54 100644
--- a/gtk/channel-display.h
+++ b/gtk/channel-display.h
@@ -33,6 +33,16 @@ typedef struct _SpiceDisplayChannel SpiceDisplayChannel;
 typedef struct _SpiceDisplayChannelClass SpiceDisplayChannelClass;
 typedef struct _SpiceDisplayChannelPrivate SpiceDisplayChannelPrivate;
 
+typedef struct _SpiceDisplayMonitorConfig SpiceDisplayMonitorConfig;
+struct _SpiceDisplayMonitorConfig {
+    guint id;
+    guint surface_id;
+    guint x;
+    guint y;
+    guint width;
+    guint height;
+};
+
 /**
  * SpiceDisplayChannel:
  *
-- 
1.7.10.4



More information about the Spice-devel mailing list