[maemo-commits] [maemo-commits] r9274 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . background-manager src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jan 23 18:04:13 EET 2007
Author: jobi
Date: 2007-01-23 18:04:11 +0200 (Tue, 23 Jan 2007)
New Revision: 9274

Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.h
   projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.xml.in
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.h
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-window.c
Log:

2007-01-23  Johan Bilien  <johan.bilien at nokia.com>

	* background-manager/background-manager.{c,h,xml.in}:
	- take 4 more parameters specifying the offsets due to dock windows.
	- removed all hard-coded dimensions in favour of these parameters.
	* src/hd-home-background.{c,h}:
	- apply_background[async] takes an additional GdkRectangle
	representing the workarea.
	- added _notify handler to set refresh the background when the
	workarea changes
	- fetch the workarea and give it to _apply_background calls



Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-23 14:32:30 UTC (rev 9273)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-23 16:04:11 UTC (rev 9274)
@@ -1,3 +1,15 @@
+2007-01-23  Johan Bilien  <johan.bilien at nokia.com>
+
+	* background-manager/background-manager.{c,h,xml.in}:
+	- take 4 more parameters specifying the offsets due to dock windows.
+	- removed all hard-coded dimensions in favour of these parameters.
+	* src/hd-home-background.{c,h}:
+	- apply_background[async] takes an additional GdkRectangle
+	representing the workarea.
+	- added _notify handler to set refresh the background when the
+	workarea changes
+	- fetch the workarea and give it to _apply_background calls
+
 2007-01-23  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* configure.ac, src/hd-home-background-dialog.c: make hildon-fm an

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.c	2007-01-23 14:32:30 UTC (rev 9273)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.c	2007-01-23 16:04:11 UTC (rev 9274)
@@ -45,8 +45,6 @@
 #define HILDON_HOME_IMAGE_FORMAT           "png"
 #define HILDON_HOME_IMAGE_ALPHA_FULL       255
 #define HILDON_HOME_GCONF_MMC_COVER_OPEN   "/system/osso/af/mmc-cover-open"
-#define HILDON_HOME_TASKNAV_WIDTH          80
-#define HILDON_HOME_TITLEBAR_HEIGHT        60
 
 #define HILDON_HOME_ENV_MMC_MOUNTPOINT     "MMC_MOUNTPOINT"
 
@@ -460,22 +458,22 @@
   return dest;
 }
 
-/* this gets rather convoluted because we want to create a background
- * pixbuf of the same size of the screen and we must account the white
- * space left for the task navigator; so, we must shift the image of
- * HILDON_HOME_TASKNAV_WIDTH pixels on the x axis.
- */
 static GdkPixbuf *
 create_background_from_pixbuf (const GdkPixbuf  *src,
                                const GdkColor   *fill,
                                BackgroundMode    mode,
                                gint              width,
                                gint              height,
+                               gint              top_offset,
+                               gint              bottom_offset,
+                               gint              left_offset,
+                               gint              right_offset,
                                GError          **error)
 {
   GdkPixbuf *dest = NULL;
   gint src_width, src_height;
   gint dest_x, dest_y;
+  gint area_width, area_height;
   gdouble scaling_ratio;
   gdouble off_x, off_y;
 
@@ -494,143 +492,115 @@
 
   src_width = gdk_pixbuf_get_width (src);
   src_height = gdk_pixbuf_get_height (src);
+  area_width = width - left_offset - right_offset;
+  area_height = height - top_offset - bottom_offset;
 
   g_debug ("*** background: (w:%d, h:%d), mode: %d",
-	   src_width,
-	   src_height,
-	   mode);
+           src_width,
+           src_height,
+           mode);
 
-  if (src_width == (width - HILDON_HOME_TASKNAV_WIDTH) &&
-      src_height == height)
+  if (src_width == area_width &&
+      src_height == area_height)
     {
       gdk_pixbuf_composite (src,
-		            dest,
-			    0, 0,
-			    width, height,
-			    HILDON_HOME_TASKNAV_WIDTH, 0,
-			    1.0, 1.0,
-			    GDK_INTERP_NEAREST,
-			    0xFF);
+                            dest,
+                            0, 0,
+                            width, height,
+                            left_offset, top_offset,
+                            1.0, 1.0,
+                            GDK_INTERP_NEAREST,
+                            0xFF);
       if (!dest)
         {
           g_set_error (error, BACKGROUND_MANAGER_ERROR,
-		       BACKGROUND_MANAGER_ERROR_SYSTEM_RESOURCES,
-		       "Unable to composite the background color with the image");
+                       BACKGROUND_MANAGER_ERROR_SYSTEM_RESOURCES,
+                       "Unable to composite the background color with the image");
 
-	  return NULL;
-	}
+          return NULL;
+        }
 
       g_debug ("*** We got a background pixbuf");
 
       return dest;
     }
-  
+
   switch (mode)
     {
-    case BACKGROUND_CENTERED:
-      if (src_width < (width - HILDON_HOME_TASKNAV_WIDTH))
-        {
-          dest_x = MAX (HILDON_HOME_TASKNAV_WIDTH,
-                        (width - HILDON_HOME_TASKNAV_WIDTH - src_width)
-                         / 2
-                         + HILDON_HOME_TASKNAV_WIDTH);
-	}
-      else
-	{
-	  dest_x = MAX (HILDON_HOME_TASKNAV_WIDTH,
-                        (width - HILDON_HOME_TASKNAV_WIDTH - src_width)
-                        / 2
-                        + HILDON_HOME_TASKNAV_WIDTH);
-	}
+      case BACKGROUND_CENTERED:
+          off_x = (area_width - src_width) / 2 + left_offset;
+          off_y = (area_height - src_height) / 2 + top_offset;
 
-      if (src_height < height)
-        {
-          dest_y = MAX (0, (height - src_height) / 2);
-	}
-      else
-        {
-	  dest_y = MAX (0, (height - src_height) / 2);
-	}
-      
-      off_x = (width - HILDON_HOME_TASKNAV_WIDTH - src_width)
-              / 2
-              + HILDON_HOME_TASKNAV_WIDTH;
-      off_y = (height-src_height) / 2;
-      
-      gdk_pixbuf_composite (src, dest,
-		            dest_x, dest_y,
-		            MIN (src_width, width - HILDON_HOME_TASKNAV_WIDTH),
-			    MIN (src_height, height),
-			    off_x, off_y,
-			    1.0, 1.0,
-			    GDK_INTERP_NEAREST,
-			    HILDON_HOME_IMAGE_ALPHA_FULL);
-      break;
-    case BACKGROUND_SCALED:
-      scaling_ratio = MIN ((gdouble) ((gdouble) (width - HILDON_HOME_TASKNAV_WIDTH) / src_width),
-		           (gdouble) height / src_height);
-      dest_x = (gint) (MAX (HILDON_HOME_TASKNAV_WIDTH,
-                HILDON_HOME_TASKNAV_WIDTH +
-			    (width
-			     - HILDON_HOME_TASKNAV_WIDTH
-			     - scaling_ratio
-			     * src_width) / 2));
-      dest_y = (gint) (MAX (0,
-			    (height
-			     - scaling_ratio
-			     * src_height) / 2));
+          dest_x = MAX (left_offset, off_x);
 
-      gdk_pixbuf_composite (src, dest,
-			    dest_x, dest_y,
-		        scaling_ratio * src_width,
-			    scaling_ratio * src_height,
-			    MAX (HILDON_HOME_TASKNAV_WIDTH,
-                 HILDON_HOME_TASKNAV_WIDTH +
-				 (width
-				  - HILDON_HOME_TASKNAV_WIDTH
-				  - scaling_ratio
-				  * src_width) / 2),
-			    MAX (0, 
-				 (height
-				  - scaling_ratio
-				  * src_height) / 2),
-			    scaling_ratio, scaling_ratio,
-			    GDK_INTERP_NEAREST,
-			    HILDON_HOME_IMAGE_ALPHA_FULL);
-      break;
-    case BACKGROUND_TILED:
-        for (dest_x = HILDON_HOME_TASKNAV_WIDTH;
-	     dest_x < width;
-	     dest_x += src_width)
-          {
-            for (dest_y = 0;
-	         dest_y < height;
-                 dest_y += src_height)
-              {
-                gdk_pixbuf_composite (src, dest,
-				      dest_x, dest_y,
-				      MIN (src_width, width - dest_x),
-				      MIN (src_height, height - dest_y),
-				      dest_x, dest_y,
-				      1.0, 1.0,
-				      GDK_INTERP_NEAREST,
-				      HILDON_HOME_IMAGE_ALPHA_FULL);
-              }
-	  }
-      break;
-    case BACKGROUND_STRETCHED:
-      gdk_pixbuf_composite (src, dest,
-	      		    HILDON_HOME_TASKNAV_WIDTH, 0,
-			    width - HILDON_HOME_TASKNAV_WIDTH, height,
-			    HILDON_HOME_TASKNAV_WIDTH, 0,
-			    (gdouble) (width-HILDON_HOME_TASKNAV_WIDTH) / src_width,
-			    ((gdouble) height) / src_height,
-			    GDK_INTERP_NEAREST,
-			    HILDON_HOME_IMAGE_ALPHA_FULL);
-      break;
-    default:
-      g_assert_not_reached ();
-      break;
+          dest_y = MAX (top_offset, off_y);
+
+          gdk_pixbuf_composite (src, dest,
+                                dest_x, dest_y,
+                                MIN (src_width, area_width),
+                                MIN (src_height, area_height),
+                                off_x, off_y,
+                                1.0, 1.0,
+                                GDK_INTERP_NEAREST,
+                                HILDON_HOME_IMAGE_ALPHA_FULL);
+          break;
+      case BACKGROUND_SCALED:
+          scaling_ratio = MIN (((gdouble) area_width / src_width),
+                               (gdouble) area_height / src_height);
+          dest_x = (gint) (MAX (left_offset,
+                                left_offset +
+                                (area_width
+                                 - scaling_ratio
+                                 * src_width) / 2));
+          dest_y = (gint) (MAX (top_offset,
+                                top_offset + 
+                                 (area_height
+                                 - scaling_ratio
+                                 * src_height) / 2));
+
+          gdk_pixbuf_composite (src, dest,
+                                dest_x, dest_y,
+                                scaling_ratio * src_width,
+                                scaling_ratio * src_height,
+                                dest_x,
+                                dest_y,
+                                scaling_ratio, scaling_ratio,
+                                GDK_INTERP_NEAREST,
+                                HILDON_HOME_IMAGE_ALPHA_FULL);
+          break;
+      case BACKGROUND_TILED:
+          for (dest_x = left_offset;
+               dest_x < width - right_offset;
+               dest_x += src_width)
+            {
+              for (dest_y = top_offset;
+                   dest_y < height - bottom_offset;
+                   dest_y += src_height)
+                {
+                  gdk_pixbuf_composite (src, dest,
+                                        dest_x, dest_y,
+                                        MIN (src_width, width - dest_x),
+                                        MIN (src_height, height - dest_y),
+                                        dest_x, dest_y,
+                                        1.0, 1.0,
+                                        GDK_INTERP_NEAREST,
+                                        HILDON_HOME_IMAGE_ALPHA_FULL);
+                }
+            }
+          break;
+      case BACKGROUND_STRETCHED:
+          gdk_pixbuf_composite (src, dest,
+                                left_offset, top_offset,
+                                area_width, area_height,
+                                left_offset, top_offset,
+                                (gdouble) area_width  / src_width,
+                                (gdouble) area_height / src_height,
+                                GDK_INTERP_NEAREST,
+                                HILDON_HOME_IMAGE_ALPHA_FULL);
+          break;
+      default:
+          g_assert_not_reached ();
+          break;
     }
 
   return dest;
@@ -652,11 +622,16 @@
                       gint              window_width,
                       gint              window_height,
                       gboolean          cancellable,
+                      gint              top_offset,
+                      gint              bottom_offset,
+                      gint              left_offset,
+                      gint              right_offset,
                       GError          **error)
 {
   GError *bg_error;
   GdkPixbuf *pixbuf;
   GdkPixbuf *compose;
+  gint titlebar_height = 0;
 
   g_debug ("Compositing background image...");
 
@@ -669,6 +644,10 @@
                                               mode,
                                               window_width,
                                               window_height,
+                                              top_offset,
+                                              bottom_offset,
+                                              left_offset,
+                                              right_offset,
                                               &bg_error);
     }
   else
@@ -692,6 +671,8 @@
     {
       compose = load_image_from_file (titlebar_path, cancellable, &bg_error);
 
+      titlebar_height = gdk_pixbuf_get_height (compose);
+
       if (bg_error)
         {
           g_warning ("Unable to load titlebar pixbuf: %s", bg_error->message);
@@ -709,14 +690,20 @@
       else
         {
           g_debug ("Compositing titlebar");
+          /* Scale it horizontally */
+          double x_scale;
 
+          x_scale = (double)(window_width - left_offset - right_offset) /
+                    gdk_pixbuf_get_width (compose);
+
           gdk_pixbuf_composite (compose,
                                 pixbuf,
-                                HILDON_HOME_TASKNAV_WIDTH, 0,
-                                gdk_pixbuf_get_width (compose),
+                                left_offset, top_offset,
+                                window_width - left_offset - right_offset,
                                 gdk_pixbuf_get_height (compose),
-                                HILDON_HOME_TASKNAV_WIDTH, 0,
-                                1.0, 1.0,
+                                left_offset, top_offset,
+                                x_scale,
+                                1.0,
                                 GDK_INTERP_NEAREST,
                                 HILDON_HOME_IMAGE_ALPHA_FULL);
 
@@ -752,8 +739,7 @@
           g_debug ("Compositing sidebar (w:%d, h:%d)",
                    width, height);
 
-          sidebar_height = window_height
-              - HILDON_HOME_TITLEBAR_HEIGHT;
+          sidebar_height = window_height - titlebar_height;
           if (height != sidebar_height)
             {
               GdkPixbuf *scaled;
@@ -776,12 +762,12 @@
 
           gdk_pixbuf_composite (compose,
                                 pixbuf,
-                                HILDON_HOME_TASKNAV_WIDTH,
-                                HILDON_HOME_TITLEBAR_HEIGHT,
+                                left_offset,
+                                top_offset + titlebar_height,
                                 gdk_pixbuf_get_width (compose),
                                 gdk_pixbuf_get_height (compose),
-                                HILDON_HOME_TASKNAV_WIDTH,
-                                0,
+                                left_offset,
+                                top_offset,
                                 1.0, 1.0,
                                 GDK_INTERP_NEAREST,
                                 HILDON_HOME_IMAGE_ALPHA_FULL);
@@ -847,6 +833,10 @@
                                    guint16              green,
                                    guint16              blue,
                                    BackgroundMode       mode,
+                                   gint32               top_offset,
+                                   gint32               bottom_offset,
+                                   gint32               left_offset,
+                                   gint32               right_offset,
                                    gint                *pixmap_xid,
                                    GError             **error)
 {
@@ -941,6 +931,10 @@
                                      width,
                                      height,
                                      TRUE,
+                                     top_offset,
+                                     bottom_offset,
+                                     left_offset,
+                                     right_offset,
                                      &local_error);
 
   if (image)

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.h	2007-01-23 14:32:30 UTC (rev 9273)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.h	2007-01-23 16:04:11 UTC (rev 9274)
@@ -102,6 +102,10 @@
                              guint16              green,
                              guint16              blue,
                              BackgroundMode       mode,
+                             gint32               top_offset,
+                             gint32               bottom_offset,
+                             gint32               left_offset,
+                             gint32               right_offset,
                              gint                *pixmap_xid,
                              GError             **error);
 

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.xml.in
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.xml.in	2007-01-23 14:32:30 UTC (rev 9273)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/background-manager/background-manager.xml.in	2007-01-23 16:04:11 UTC (rev 9274)
@@ -10,6 +10,10 @@
       <arg type="i" name="red"/>
       <arg type="i" name="green"/>
       <arg type="i" name="blue"/>
+      <arg type="i" name="top_offset"/>
+      <arg type="i" name="bottom_offset"/>
+      <arg type="i" name="left_offset"/>
+      <arg type="i" name="right_offset"/>
       <arg type="i" name="mode"/>
       <arg type="i" direction="out" name="pixmap_id"/>
     </method>

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.c	2007-01-23 14:32:30 UTC (rev 9273)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.c	2007-01-23 16:04:11 UTC (rev 9274)
@@ -554,6 +554,7 @@
 void
 hd_home_background_apply (HDHomeBackground *background,
                           GdkWindow        *window,
+                          GdkRectangle     *area,
                           GError          **error)
 {
   HDHomeBackgroundPrivate  *priv;
@@ -562,6 +563,7 @@
   GError               *local_error = NULL;
   gint                  pixmap_xid;
   GdkPixmap            *pixmap = NULL;
+  gint32                top_offset, bottom_offset, right_offset, left_offset;
 
   g_return_if_fail (HD_IS_HOME_BACKGROUND (background) && window);
   priv = background->priv;
@@ -579,6 +581,18 @@
                                  HILDON_BACKGROUND_MANAGER_OBJECT_PATH,
                                  HILDON_BACKGROUND_MANAGER_INTERFACE);
 
+  top_offset = bottom_offset = right_offset = left_offset = 0;
+  if (area)
+    {
+      gint width, height;
+      gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+
+      top_offset = area->y;
+      bottom_offset = MAX (0, height - area->height - area->y);
+      left_offset = area->x;
+      right_offset = MAX (0, width- area->width - area->x);
+    }
+
   g_debug ("Trying to apply background to window: %x", (int)GDK_WINDOW_XID(window));
 
 #define S(string) (string?string:"")
@@ -591,6 +605,10 @@
                                                       priv->color->green,
                                                       priv->color->blue,
                                                       priv->mode,
+                                                      top_offset,
+                                                      bottom_offset,
+                                                      left_offset,
+                                                      right_offset,
                                                       &pixmap_xid,
                                                       error);
 #undef S
@@ -662,6 +680,7 @@
 void
 hd_home_background_apply_async (HDHomeBackground               *background,
                                 GdkWindow                      *window,
+                                GdkRectangle                   *area,
                                 HDHomeBackgroundApplyCallback   cb,
                                 gpointer                        user_data)
 {
@@ -670,6 +689,7 @@
   DBusGConnection          *connection;
   GError                   *local_error = NULL;
   struct cb_data           *data;
+  gint32                    top_offset, bottom_offset, right_offset, left_offset;
 
   g_return_if_fail (HD_IS_HOME_BACKGROUND (background) && window);
   priv = background->priv;
@@ -696,6 +716,18 @@
   data->user_data = user_data;
   data->window = window;
 
+  top_offset = bottom_offset = right_offset = left_offset = 0;
+  if (area)
+    {
+      gint width, height;
+      gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+
+      top_offset = area->y;
+      bottom_offset = MAX (0, height - area->height - area->y);
+      left_offset = area->x;
+      right_offset = MAX (0, width- area->width - area->x);
+    }
+
   g_debug ("Applying background %s aynchronously",
            priv->filename);
 
@@ -711,6 +743,10 @@
                                                  priv->color->green,
                                                  priv->color->blue,
                                                  priv->mode,
+                                                 top_offset,
+                                                 bottom_offset,
+                                                 left_offset,
+                                                 right_offset,
                                                  (org_maemo_hildon_background_manager_set_background_reply) hd_home_background_apply_async_dbus_callback,
                                                  data);
 #undef S

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.h	2007-01-23 14:32:30 UTC (rev 9273)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-background.h	2007-01-23 16:04:11 UTC (rev 9274)
@@ -71,9 +71,11 @@
                                                  GError          **error);
 void        hd_home_background_apply            (HDHomeBackground *background,
                                                  GdkWindow        *window,
+                                                 GdkRectangle     *region,
                                                  GError          **error);
 void        hd_home_background_apply_async      (HDHomeBackground *background,
                                                  GdkWindow        *window,
+                                                 GdkRectangle     *region,
                                                  HDHomeBackgroundApplyCallback
                                                                    cb,
                                                  gpointer          user_data);

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-window.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-window.c	2007-01-23 14:32:30 UTC (rev 9273)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-home-window.c	2007-01-23 16:04:11 UTC (rev 9274)
@@ -109,6 +109,11 @@
                              const GValue *value,
                              GParamSpec   *pspec);
 
+static void
+hd_home_window_notify (GObject     *object,
+                       GParamSpec  *pspec);
+
+
 #ifdef HAVE_LIBOSSO
 static void
 hd_home_window_set_osso_context (HDHomeWindow *window, osso_context_t *osso);
@@ -180,6 +185,7 @@
   object_class->constructor  = hd_home_window_constructor;
   object_class->set_property = hd_home_window_set_property;
   object_class->get_property = hd_home_window_get_property;
+  object_class->notify       = hd_home_window_notify;
 
   widget_class->map_event = hd_home_window_map_event;
   widget_class->style_set = hd_home_window_style_set;
@@ -369,6 +375,21 @@
 }
 
 static void
+hd_home_window_notify (GObject     *object,
+                       GParamSpec  *pspec)
+{
+  HDHomeWindowPrivate  *priv;
+  priv = HD_HOME_WINDOW_GET_PRIVATE (object);
+
+  if (g_str_equal (pspec->name, "work-area"))
+    {
+      g_debug ("Work area changed, reapplying the background");
+      hd_home_window_set_background (HD_HOME_WINDOW (object),
+                                     priv->background);
+    }
+}
+
+static void
 background_apply_callback (HDHomeBackground *background,
                            gint              pixmap_xid,
                            GError           *error,
@@ -443,10 +464,14 @@
                           GdkEventAny  *event)
 {
   HDHomeWindowPrivate  *priv = HD_HOME_WINDOW_GET_PRIVATE (widget);
+  GdkRectangle         *workarea;
 
+  g_object_get (widget, "work-area", &workarea, NULL);
+
   if (priv->background)
     hd_home_background_apply_async (priv->background,
                                     widget->window,
+                                    workarea,
                                     (HDHomeBackgroundApplyCallback)
                                     background_apply_callback,
                                     widget);
@@ -532,8 +557,12 @@
 
           if (GTK_WIDGET_MAPPED (widget))
             {
+              GdkRectangle *workarea;
+              g_object_get (widget, "work-area", &workarea, NULL);
+
               hd_home_background_apply_async (priv->background,
                                               widget->window,
+                                              workarea,
                                               (HDHomeBackgroundApplyCallback)
                                               background_apply_callback,
                                               widget);
@@ -771,16 +800,9 @@
 static void
 hd_home_window_calibration_activate (HDHomeWindow *window)
 {
-  HDHomeWindowPrivate  *priv;
   hd_home_window_applet_activate (window,
                                   HCP_PLUGIN_PATH_CALIBRATION);
       
-  priv = HD_HOME_WINDOW_GET_PRIVATE (window);
-  hd_home_background_apply_async (priv->background,
-                                  GTK_WIDGET (window)->window,
-                                  (HDHomeBackgroundApplyCallback)
-                                  background_apply_callback,
-                                  window);
 }
 #endif
 
@@ -1010,7 +1032,10 @@
                                HDHomeBackground *background)
 {
   HDHomeWindowPrivate  *priv = HD_HOME_WINDOW_GET_PRIVATE (window);
+  GdkRectangle *workarea;
 
+  g_object_get (window, "work-area", &workarea, NULL);
+
   if (priv->background)
     g_object_unref (priv->background);
 
@@ -1023,6 +1048,7 @@
     {
       hd_home_background_apply_async (background,
                                       GTK_WIDGET (window)->window,
+                                      workarea,
                                       (HDHomeBackgroundApplyCallback)
                                       background_apply_callback,
                                       window);
@@ -1036,7 +1062,10 @@
                                        GtkDialog *dialog)
 {
   HDHomeBackground *background;
+  GdkRectangle *workarea;
 
+  g_object_get (window, "work-area", &workarea, NULL);
+
   background =
       hd_home_background_dialog_get_background (HD_HOME_BACKGROUND_DIALOG (dialog));
 
@@ -1047,6 +1076,7 @@
           hd_home_background_apply_async 
               (background,
                GTK_WIDGET (window)->window,
+               workarea,
                (HDHomeBackgroundApplyCallback)background_apply_and_save_callback,
                window);
           break;
@@ -1054,6 +1084,7 @@
           hd_home_background_apply_async 
               (background,
                GTK_WIDGET (window)->window,
+               workarea,
                (HDHomeBackgroundApplyCallback)background_apply_callback,
                window);
 


More information about the maemo-commits mailing list