[gnome-panel] panel: Force background redraw of PanelSeparator on orientation change



commit 8986309114f54f1d2eba7e4838ee594b13a97c8f
Author: Peter Hurley <peter hurleysoftware com>
Date:   Sun Mar 4 10:00:02 2012 -0500

    panel: Force background redraw of PanelSeparator on orientation change
    
    Force a redraw of the background when the panel orientation has changed
    to ensure the background change is performed even if the allocation
    hasn't changed (for example, if the PanelSeparator is square).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671329

 gnome-panel/panel-separator.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/gnome-panel/panel-separator.c b/gnome-panel/panel-separator.c
index 4071bd8..268b981 100644
--- a/gnome-panel/panel-separator.c
+++ b/gnome-panel/panel-separator.c
@@ -37,6 +37,8 @@ struct _PanelSeparatorPrivate {
 
 	GtkOrientation  orientation;
 	GtkWidget      *separator;
+
+	unsigned char   force_background_redraw: 1;
 };
 
 G_DEFINE_TYPE (PanelSeparator, panel_separator, GTK_TYPE_EVENT_BOX)
@@ -132,6 +134,7 @@ static void
 panel_separator_size_allocate (GtkWidget     *widget,
 			       GtkAllocation *allocation)
 {
+	PanelSeparator  *separator = PANEL_SEPARATOR (widget);
 	GtkAllocation    old_allocation;
 	GtkStyleContext *context;
 	GtkStateFlags    state;
@@ -172,19 +175,22 @@ panel_separator_size_allocate (GtkWidget     *widget,
 	if (child && gtk_widget_get_visible (child))
 		gtk_widget_size_allocate (child, &new_allocation);
 
-	if (old_allocation.x      == allocation->x &&
-	    old_allocation.y      == allocation->y &&
-	    old_allocation.width  == allocation->width &&
-	    old_allocation.height == allocation->height)
+	if (!separator->priv->force_background_redraw &&
+	    (old_allocation.x      == allocation->x &&
+	     old_allocation.y      == allocation->y &&
+	     old_allocation.width  == allocation->width &&
+	     old_allocation.height == allocation->height))
 		return;
 
-	background = &PANEL_SEPARATOR (widget)->priv->panel->background;
+	separator->priv->force_background_redraw = FALSE;
+
+	background = &separator->priv->panel->background;
 
 	if (background->type == PANEL_BACK_NONE ||
 	   (background->type == PANEL_BACK_COLOR && !background->has_alpha))
 		return;
 
-	panel_separator_change_background (PANEL_SEPARATOR (widget));
+	panel_separator_change_background (separator);
 }
 
 static void
@@ -226,6 +232,7 @@ panel_separator_init (PanelSeparator *separator)
 	separator->priv->panel = NULL;
 	separator->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
 	separator->priv->separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
+	separator->priv->force_background_redraw = FALSE;
 
 	gtk_container_add (GTK_CONTAINER (separator),
 			   separator->priv->separator);
@@ -275,7 +282,8 @@ panel_separator_set_orientation (PanelSeparator   *separator,
 	gtk_orientable_set_orientation (GTK_ORIENTABLE (separator->priv->separator),
 					orient_separator);
 
-	gtk_widget_queue_draw (GTK_WIDGET (separator));
+	separator->priv->force_background_redraw = TRUE;
+	gtk_widget_queue_resize (GTK_WIDGET (separator));
 }
 
 void



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