Re: [evolution-patches] Patch for bug #54503



OK. It looks like in GTK+ 2.6, a grab_notify override was added to the
GtkButton code, to help fix some issue with the GtkPathBar widget in the
GtkFileChooser. Attached is a new patch, which also overrides the event,
so that we get the same behavior as before when clicking on the arrow.

-- dobey

On Thu, 2005-02-10 at 15:51 -0700, JP Rosevear wrote:
> On Thu, 2005-02-10 at 16:38 -0500, Rodney Dawes wrote:
> >This patch fixes the theming issues in bug #54503.
> 
> As discussed on IRC, when the popup menu is shown the button is not
> GTK_SHADOW_IN.  If this works in 2.4 and not in 2.6 as you noted, we can
> put this patch in once the bug in gtk 2.6 is confirmed.
> 
> -JP
? widgets/e-timezone-dialog/e-timezone-dialog.gladep
? widgets/misc/gtkmenutoolbutton.c
? widgets/misc/gtkmenutoolbutton.h
? widgets/misc/test-source-option-menu
? widgets/misc/test-source-selector
? widgets/misc/test-title-bar
Index: widgets/misc/e-combo-button.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-combo-button.c,v
retrieving revision 1.20
diff -u -p -r1.20 e-combo-button.c
--- widgets/misc/e-combo-button.c	4 Jan 2005 07:39:56 -0000	1.20
+++ widgets/misc/e-combo-button.c	11 Feb 2005 16:36:11 -0000
@@ -101,7 +101,14 @@ paint (EComboButton *combo_button,
 	int x, y, width, height;
 	int border_width;
 
-	shadow_type = GTK_BUTTON (widget)->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
+	if (GTK_BUTTON (widget)->depressed)
+		shadow_type = GTK_SHADOW_IN;
+	else if (GTK_BUTTON (widget)->relief == GTK_RELIEF_NONE &&
+		 (GTK_WIDGET_STATE (widget) == GTK_STATE_NORMAL ||
+		  GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE))
+		shadow_type = GTK_SHADOW_NONE;
+	else
+		shadow_type = GTK_SHADOW_OUT;
 
 	border_width = GTK_CONTAINER (widget)->border_width;
 
@@ -134,19 +141,14 @@ paint (EComboButton *combo_button,
 		height -= 2 * (focus_width + focus_pad);
 	}
 
-	if ((GTK_BUTTON (widget)->relief != GTK_RELIEF_NONE) ||
-	    ((GTK_WIDGET_STATE(widget) != GTK_STATE_NORMAL) &&
-	     (GTK_WIDGET_STATE(widget) != GTK_STATE_ACTIVE || GTK_BUTTON (widget)->depressed) &&
-	     (GTK_WIDGET_STATE(widget) != GTK_STATE_INSENSITIVE))) {
-		gtk_paint_box (widget->style, widget->window,
-			       GTK_WIDGET_STATE (widget), shadow_type,
-			       area, widget, "button",
-			       x, y, separator_x, height);
-		gtk_paint_box (widget->style, widget->window,
-			       GTK_WIDGET_STATE (widget), shadow_type,
-			       area, widget, "button",
-			       separator_x, y, width - separator_x, height);
-	}
+	gtk_paint_box (widget->style, widget->window,
+		       GTK_WIDGET_STATE (widget), shadow_type,
+		       area, widget, "button",
+		       x, y, separator_x, height);
+	gtk_paint_box (widget->style, widget->window,
+		       GTK_WIDGET_STATE (widget), shadow_type,
+		       area, widget, "button",
+		       separator_x, y, width - separator_x, height);
 
 	if (GTK_WIDGET_HAS_FOCUS (widget)) {
 		if (interior_focus) {
@@ -390,6 +392,18 @@ impl_released (GtkButton *button)
 	}
 }
 
+static void
+impl_grab_notify (GtkWidget *widget,
+		  gboolean   was_grabbed)
+{
+  GtkButton *button = GTK_BUTTON (widget);
+
+  if (was_grabbed)
+    {
+      button->in_button = FALSE;
+      gtk_button_released (button);
+    }
+}
 
 static void
 e_combo_button_class_init (EComboButtonClass *combo_button_class)
@@ -405,6 +419,7 @@ e_combo_button_class_init (EComboButtonC
 	widget_class->button_press_event = impl_button_press_event;
 	widget_class->leave_notify_event = impl_leave_notify_event;
 	widget_class->expose_event       = impl_expose_event;
+	widget_class->grab_notify        = impl_grab_notify;
 
 	button_class = GTK_BUTTON_CLASS (object_class);
 	button_class->released = impl_released;


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