[virt-tools-list] [PATCH 1/3] virt-viewer-display: Add monitor property

Hans de Goede hdegoede at redhat.com
Wed Mar 20 14:05:38 UTC 2013


Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/virt-viewer-display.c | 34 ++++++++++++++++++++++++++++++++++
 src/virt-viewer-display.h |  2 ++
 2 files changed, 36 insertions(+)

diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 099ac76..dda9f77 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -41,6 +41,7 @@ struct _VirtViewerDisplayPrivate
     guint zoom_level;
     gboolean zoom;
     gint nth_display;
+    gint monitor;
     guint show_hint;
     VirtViewerSession *session;
     gboolean auto_resize;
@@ -81,6 +82,7 @@ enum {
     PROP_SHOW_HINT,
     PROP_SESSION,
     PROP_SELECTABLE,
+    PROP_MONITOR,
 };
 
 static void
@@ -176,6 +178,17 @@ virt_viewer_display_class_init(VirtViewerDisplayClass *class)
                                                          FALSE,
                                                          G_PARAM_READABLE));
 
+    g_object_class_install_property(object_class,
+                                    PROP_MONITOR,
+                                    g_param_spec_int("monitor",
+                                                     "Monitor",
+                                                     "Display Monitor",
+                                                     -1,
+                                                     G_MAXINT32,
+                                                     -1,
+                                                     G_PARAM_READWRITE |
+                                                     G_PARAM_CONSTRUCT));
+
     g_signal_new("display-pointer-grab",
                  G_OBJECT_CLASS_TYPE(object_class),
                  G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
@@ -278,6 +291,9 @@ virt_viewer_display_set_property(GObject *object,
         g_warn_if_fail(priv->session == NULL);
         priv->session = g_value_get_object(value);
         break;
+    case PROP_MONITOR:
+        priv->monitor = g_value_get_int(value);
+        break;
 
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -313,6 +329,9 @@ virt_viewer_display_get_property(GObject *object,
     case PROP_SELECTABLE:
         g_value_set_boolean(value, virt_viewer_display_get_selectable(display));
         break;
+    case PROP_MONITOR:
+        g_value_set_int(value, priv->monitor);
+        break;
 
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -601,6 +620,21 @@ gboolean virt_viewer_display_get_auto_resize(VirtViewerDisplay *self)
     return self->priv->auto_resize;
 }
 
+void virt_viewer_display_set_monitor(VirtViewerDisplay *self, gint monitor)
+{
+    g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(self));
+
+    self->priv->monitor = monitor;
+    g_object_notify(G_OBJECT(self), "monitor");
+}
+
+gint virt_viewer_display_get_monitor(VirtViewerDisplay *self)
+{
+    g_return_val_if_fail(VIRT_VIEWER_IS_DISPLAY(self), -1);
+
+    return self->priv->monitor;
+}
+
 void virt_viewer_display_release_cursor(VirtViewerDisplay *self)
 {
     VirtViewerDisplayClass *klass;
diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
index af78709..21d6fa4 100644
--- a/src/virt-viewer-display.h
+++ b/src/virt-viewer-display.h
@@ -115,6 +115,8 @@ guint virt_viewer_display_get_show_hint(VirtViewerDisplay *display);
 VirtViewerSession* virt_viewer_display_get_session(VirtViewerDisplay *display);
 void virt_viewer_display_set_auto_resize(VirtViewerDisplay *display, gboolean auto_resize);
 gboolean virt_viewer_display_get_auto_resize(VirtViewerDisplay *display);
+void virt_viewer_display_set_monitor(VirtViewerDisplay *display, gint monitor);
+gint virt_viewer_display_get_monitor(VirtViewerDisplay *display);
 void virt_viewer_display_release_cursor(VirtViewerDisplay *display);
 
 void virt_viewer_display_close(VirtViewerDisplay *display);
-- 
1.8.1.4




More information about the virt-tools-list mailing list