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

[virt-tools-list] [PATCH virt-viewer 2/4] display: add fullscreen property



Now that fullscreen state is no longer global to application, we need to
have the current state per display
---
 src/virt-viewer-display.c | 31 +++++++++++++++++++++++++++++++
 src/virt-viewer-display.h |  2 ++
 2 files changed, 33 insertions(+)

diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index b7bf6ef..253d96a 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -48,6 +48,7 @@ struct _VirtViewerDisplayPrivate
     guint show_hint;
     VirtViewerSession *session;
     gboolean auto_resize;
+    gboolean fullscreen;
 };
 
 #if !GTK_CHECK_VERSION(3, 0, 0)
@@ -80,6 +81,7 @@ enum {
 
     PROP_DESKTOP_WIDTH,
     PROP_DESKTOP_HEIGHT,
+    PROP_FULLSCREEN,
     PROP_NTH_DISPLAY,
     PROP_ZOOM,
     PROP_ZOOM_LEVEL,
@@ -193,6 +195,14 @@ virt_viewer_display_class_init(VirtViewerDisplayClass *class)
                                                      G_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT));
 
+    g_object_class_install_property(object_class,
+                                    PROP_FULLSCREEN,
+                                    g_param_spec_boolean("fullscreen",
+                                                         "Fullscreen",
+                                                         "Fullscreen",
+                                                         FALSE,
+                                                         G_PARAM_READABLE));
+
     g_signal_new("display-pointer-grab",
                  G_OBJECT_CLASS_TYPE(object_class),
                  G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
@@ -338,6 +348,9 @@ virt_viewer_display_get_property(GObject *object,
     case PROP_MONITOR:
         g_value_set_int(value, priv->monitor);
         break;
+    case PROP_FULLSCREEN:
+        g_value_set_boolean(value, virt_viewer_display_get_fullscreen(display));
+        break;
 
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -705,6 +718,24 @@ void virt_viewer_display_close(VirtViewerDisplay *self)
     klass->close(self);
 }
 
+void virt_viewer_display_set_fullscreen(VirtViewerDisplay *self, gboolean fullscreen)
+{
+    g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(self));
+
+    if (self->priv->fullscreen == fullscreen)
+        return;
+
+    self->priv->fullscreen = fullscreen;
+    g_object_notify(G_OBJECT(self), "fullscreen");
+}
+
+gboolean virt_viewer_display_get_fullscreen(VirtViewerDisplay *self)
+{
+    g_return_val_if_fail(VIRT_VIEWER_IS_DISPLAY(self), FALSE);
+
+    return self->priv->fullscreen;
+}
+
 /*
  * Local variables:
  *  c-indent-level: 4
diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
index fd238c5..99844c4 100644
--- a/src/virt-viewer-display.h
+++ b/src/virt-viewer-display.h
@@ -118,6 +118,8 @@ void virt_viewer_display_set_auto_resize(VirtViewerDisplay *display, gboolean au
 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_set_fullscreen(VirtViewerDisplay *display, gboolean fullscreen);
+gboolean virt_viewer_display_get_fullscreen(VirtViewerDisplay *display);
 void virt_viewer_display_release_cursor(VirtViewerDisplay *display);
 
 void virt_viewer_display_close(VirtViewerDisplay *display);
-- 
1.8.3.rc1.49.g8d97506


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