[gnome-settings-daemon/randr-osd: 14/15] Add gsd_osd_window_set_auto_hide()



commit f0001e1465504578ab43eeeb2c0d46c4e423ff2b
Author: Federico Mena Quintero <federico novell com>
Date:   Tue Jan 19 17:29:54 2010 -0600

    Add gsd_osd_window_set_auto_hide()
    
    The XRANDR plugin will need to control the hiding of its OSD window,
    rather than letting the window auto-hide itself.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 plugins/common/gsd-osd-window.c |   24 ++++++++++++++++++++++--
 plugins/common/gsd-osd-window.h |    2 ++
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/plugins/common/gsd-osd-window.c b/plugins/common/gsd-osd-window.c
index 5fa2d79..0ea068e 100644
--- a/plugins/common/gsd-osd-window.c
+++ b/plugins/common/gsd-osd-window.c
@@ -48,10 +48,11 @@
 
 struct GsdOsdWindowPrivate
 {
-        guint                    is_composited : 1;
         guint                    hide_timeout_id;
         guint                    fade_timeout_id;
         double                   fade_out_alpha;
+        guint                    is_composited : 1;
+        guint                    auto_hide : 1;
 };
 
 enum {
@@ -356,7 +357,9 @@ gsd_osd_window_real_show (GtkWidget *widget)
 
         window = GSD_OSD_WINDOW (widget);
         remove_hide_timeout (window);
-        add_hide_timeout (window);
+
+        if (window->priv->auto_hide)
+                add_hide_timeout (window);
 }
 
 static void
@@ -522,6 +525,8 @@ gsd_osd_window_init (GsdOsdWindow *window)
 
         screen = gtk_widget_get_screen (GTK_WIDGET (window));
 
+        window->priv->auto_hide = TRUE;
+
         window->priv->is_composited = gdk_screen_is_composited (screen);
 
         if (window->priv->is_composited) {
@@ -567,3 +572,18 @@ gsd_osd_window_update_and_hide (GsdOsdWindow *window)
                 gtk_widget_queue_draw (GTK_WIDGET (window));
         }
 }
+
+/**
+ * gsd_osd_window_set_auto_hide:
+ * @window: a #GsdOsdWindow
+ * @auto_hide: whether to automatically hide the window some time after it is shown
+ *
+ * Sets whether the @window will automatically hide itself some time after it is
+ * shown.  This is set to TRUE by default.  Callers that need to hide the window
+ * themselves should specify FALSE here.
+ */
+void
+gsd_osd_window_set_auto_hide (GsdOsdWindow *window, gboolean auto_hide)
+{
+        window->priv->auto_hide = auto_hide;
+}
diff --git a/plugins/common/gsd-osd-window.h b/plugins/common/gsd-osd-window.h
index 40bfa2b..10d87eb 100644
--- a/plugins/common/gsd-osd-window.h
+++ b/plugins/common/gsd-osd-window.h
@@ -77,6 +77,8 @@ GtkWidget *           gsd_osd_window_new               (void);
 gboolean              gsd_osd_window_is_composited     (GsdOsdWindow      *window);
 gboolean              gsd_osd_window_is_valid          (GsdOsdWindow      *window);
 void                  gsd_osd_window_update_and_hide   (GsdOsdWindow      *window);
+void                  gsd_osd_window_set_auto_hide     (GsdOsdWindow      *window,
+                                                        gboolean           auto_hide);
 
 void                  gsd_osd_window_draw_rounded_rectangle (cairo_t *cr,
                                                              gdouble  aspect,



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