[gnome-settings-daemon] media-keys: Cache the window size



commit 95cfa17e395c3c92ef1bb95373a1e419c7f8b3f6
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Apr 16 18:25:16 2012 +0100

    media-keys: Cache the window size

 plugins/media-keys/gsd-osd-window.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/plugins/media-keys/gsd-osd-window.c b/plugins/media-keys/gsd-osd-window.c
index c882d37..0da24bb 100644
--- a/plugins/media-keys/gsd-osd-window.c
+++ b/plugins/media-keys/gsd-osd-window.c
@@ -53,6 +53,7 @@ struct GsdOsdWindowPrivate
         guint                    hide_timeout_id;
         guint                    fade_timeout_id;
         double                   fade_out_alpha;
+        int                      size;
 
         gint                     screen_width;
         gint                     screen_height;
@@ -766,7 +767,7 @@ draw_action_volume (GsdOsdWindow *window,
         double volume_box_height;
         gboolean res;
 
-        gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height);
+	window_width = window_height = window->priv->size;
 
         icon_box_width = round (window_width * ICON_SCALE);
         icon_box_height = round (window_height * ICON_SCALE);
@@ -1174,7 +1175,6 @@ gsd_osd_window_init (GsdOsdWindow *window)
         GdkScreen *screen;
         gdouble scalew, scaleh, scale;
         GdkRectangle monitor;
-        gint size;
 
         window->priv = GSD_OSD_WINDOW_GET_PRIVATE (window);
 
@@ -1194,8 +1194,10 @@ gsd_osd_window_init (GsdOsdWindow *window)
         scalew = monitor.width / 640.0;
         scaleh = monitor.height / 480.0;
         scale = MIN (scalew, scaleh);
-        size = 130 * MAX (1, scale);
-        gtk_window_set_default_size (GTK_WINDOW (window), size, size);
+        window->priv->size = 130 * MAX (1, scale);
+        gtk_window_set_default_size (GTK_WINDOW (window),
+                                     window->priv->size,
+                                     window->priv->size);
 
         window->priv->fade_out_alpha = 1.0;
 }



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