gimp r27053 - in trunk: . modules



Author: mitch
Date: Thu Sep 25 12:11:02 2008
New Revision: 27053
URL: http://svn.gnome.org/viewvc/gimp?rev=27053&view=rev

Log:
2008-09-25  Michael Natterer  <mitch gimp org>

	Bug 549195 â Color Wheel not working (GtkHSV):

	* modules/color-selector-wheel.c: change packing and size requests
	of the GtkHSV and its optional GtkAligmnent depending on the GTK+
	version used to make it work with both the old and the new version
	of the widget. Evil hacks, better don't look :)



Modified:
   trunk/ChangeLog
   trunk/modules/color-selector-wheel.c

Modified: trunk/modules/color-selector-wheel.c
==============================================================================
--- trunk/modules/color-selector-wheel.c	(original)
+++ trunk/modules/color-selector-wheel.c	Thu Sep 25 12:11:02 2008
@@ -31,6 +31,10 @@
 #include "libgimp/libgimp-intl.h"
 
 
+#ifdef __GNUC__
+#warning FIXME: remove hacks here as soon as we depend on GTK 2.14
+#endif
+
 #ifndef __GTK_HSV_H__
 
 #define GTK_TYPE_HSV (gtk_hsv_get_type ())
@@ -86,7 +90,7 @@
 static void   colorsel_wheel_size_allocate (GtkWidget         *frame,
                                             GtkAllocation     *allocation,
                                             ColorselWheel     *wheel);
-static void   colorsel_wheel_size_request  (GtkWidget         *hsv,
+static void   colorsel_wheel_size_request  (GtkWidget         *dont_use,
                                             GtkRequisition    *requisition,
                                             ColorselWheel     *wheel);
 static void   colorsel_wheel_changed       (GtkHSV            *hsv,
@@ -153,12 +157,20 @@
 
   if (gtk_check_version (2, 13, 7))
     {
+      /*  for old versions of GtkHSV, we pack the thing into an alignment
+       *  and force the alignment to have a small requisition, because
+       *  it will be smart enough to deal with a larger allocation
+       */
       GtkWidget *alignment;
 
       alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
       gtk_container_add (GTK_CONTAINER (frame), alignment);
       gtk_widget_show (alignment);
 
+      g_signal_connect (alignment, "size-request",
+                        G_CALLBACK (colorsel_wheel_size_request),
+                        wheel);
+
       frame = alignment;
     }
 
@@ -166,9 +178,16 @@
   gtk_container_add (GTK_CONTAINER (frame), wheel->hsv);
   gtk_widget_show (wheel->hsv);
 
-  g_signal_connect (wheel->hsv, "size-request",
-                    G_CALLBACK (colorsel_wheel_size_request),
-                    wheel);
+  if (! gtk_check_version (2, 13, 7))
+    {
+      /*  for new versions of GtkHSV we don't need above alignment hack,
+       *  because it is smart enough by itself to cope with a larger
+       *  allocation than it requested
+       */
+      g_signal_connect (wheel->hsv, "size-request",
+                        G_CALLBACK (colorsel_wheel_size_request),
+                        wheel);
+    }
 
   g_signal_connect (wheel->hsv, "changed",
                     G_CALLBACK (colorsel_wheel_changed),
@@ -208,14 +227,14 @@
 }
 
 static void
-colorsel_wheel_size_request (GtkWidget      *hsv,
+colorsel_wheel_size_request (GtkWidget      *dont_use,
                              GtkRequisition *requisition,
                              ColorselWheel  *wheel)
 {
   gint focus_width;
   gint focus_padding;
 
-  gtk_widget_style_get (hsv,
+  gtk_widget_style_get (wheel->hsv,
                         "focus-line-width", &focus_width,
                         "focus-padding",    &focus_padding,
                         NULL);



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