[maemo-commits] [maemo-commits] r13803 - in projects/haf/trunk/hildon-desktop: . libhildondesktop

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Sep 13 16:57:15 EEST 2007
Author: jobi
Date: 2007-09-13 16:57:14 +0300 (Thu, 13 Sep 2007)
New Revision: 13803

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c
Log:

2007-09-13 Johan Bilien  <johan.bilien at nokia.com>

	* libhildondesktop/hildon-desktop-toggle-button.c: add support
	for painting a the normal state as well.
	Fixes: NB#69508



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-13 13:46:07 UTC (rev 13802)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-13 13:57:14 UTC (rev 13803)
@@ -1,5 +1,11 @@
 2007-09-13 Johan Bilien  <johan.bilien at nokia.com>
 
+	* libhildondesktop/hildon-desktop-toggle-button.c: add support
+	for painting a the normal state as well.
+	Fixes: NB#69508
+
+2007-09-13 Johan Bilien  <johan.bilien at nokia.com>
+
 	* libhildondesktop/hildon-home-area.c: call _widget_unparent
 	in _container_remove, to avoid leaking a reference.
 	Fixes: NB#69452

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c	2007-09-13 13:46:07 UTC (rev 13802)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-toggle-button.c	2007-09-13 13:57:14 UTC (rev 13803)
@@ -45,6 +45,8 @@
 struct _HildonDesktopToggleButtonPrivate
 {
 #ifdef HAVE_X_COMPOSITE
+  Picture       normal_picture;
+  Picture       normal_picture_mask;
   Picture       focus_picture;
   Picture       focus_picture_mask;
   Picture       pressed_picture;
@@ -113,6 +115,17 @@
           g_return_val_if_fail (picture != None, FALSE);
         }
 
+      if (priv->normal_picture != None)
+        XRenderComposite (GDK_DISPLAY (),
+                          PictOpOver,
+                          priv->normal_picture,
+                          priv->normal_picture_mask,
+                          picture,
+                          event->area.x, event->area.y,
+                          event->area.x, event->area.y,
+                          event->area.x - x_offset, event->area.y - y_offset,
+                          event->area.width, event->area.height);
+
       if (priv->pressed_picture != None  && button->depressed)
         XRenderComposite (GDK_DISPLAY (),
                           PictOpOver,
@@ -157,6 +170,26 @@
       !widget->style->rc_style)
     return;
 
+  if (priv->normal_picture != None)
+    {
+      XRenderFreePicture (GDK_DISPLAY (),
+                          priv->normal_picture);
+      priv->normal_picture = None;
+    }
+
+  if (priv->normal_picture_mask != None)
+    {
+      XRenderFreePicture (GDK_DISPLAY (),
+                          priv->normal_picture_mask);
+      priv->normal_picture_mask = None;
+    }
+
+  if (widget->style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL])
+    hildon_desktop_picture_and_mask_from_file (widget->style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL],
+                                               &priv->normal_picture,
+                                               &priv->normal_picture_mask,
+                                               NULL, NULL);
+
   if (priv->focus_picture != None)
     {
       XRenderFreePicture (GDK_DISPLAY (),
@@ -171,10 +204,11 @@
       priv->focus_picture_mask = None;
     }
 
-  hildon_desktop_picture_and_mask_from_file (widget->style->rc_style->bg_pixmap_name[GTK_STATE_PRELIGHT],
-                                             &priv->focus_picture,
-                                             &priv->focus_picture_mask,
-                                             NULL, NULL);
+  if (widget->style->rc_style->bg_pixmap_name[GTK_STATE_PRELIGHT])
+    hildon_desktop_picture_and_mask_from_file (widget->style->rc_style->bg_pixmap_name[GTK_STATE_PRELIGHT],
+                                               &priv->focus_picture,
+                                               &priv->focus_picture_mask,
+                                               NULL, NULL);
 
   if (priv->pressed_picture != None)
     {
@@ -190,10 +224,11 @@
       priv->pressed_picture_mask = None;
     }
 
-  hildon_desktop_picture_and_mask_from_file (widget->style->rc_style->bg_pixmap_name[GTK_STATE_ACTIVE],
-                                             &priv->pressed_picture,
-                                             &priv->pressed_picture_mask,
-                                             NULL, NULL);
+  if (widget->style->rc_style->bg_pixmap_name[GTK_STATE_ACTIVE])
+    hildon_desktop_picture_and_mask_from_file (widget->style->rc_style->bg_pixmap_name[GTK_STATE_ACTIVE],
+                                               &priv->pressed_picture,
+                                               &priv->pressed_picture_mask,
+                                               NULL, NULL);
 
   GTK_WIDGET_CLASS (hildon_desktop_toggle_button_parent_class)->style_set (widget, old_style);
 }


More information about the maemo-commits mailing list