Commit 78479cd4 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

Bug 549195 – Color Wheel not working (GtkHSV):

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 :)


svn path=/trunk/; revision=27053
parent 123170e0
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 :)
2008-09-25 Sven Neumann <sven@gimp.org>
* app/core/gimp.[ch]: added a 'restored' flag to the Gimp object
......
......@@ -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_set_color (GimpColorSelector *selector,
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 @@ colorsel_wheel_init (ColorselWheel *wheel)
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 @@ colorsel_wheel_init (ColorselWheel *wheel)
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 @@ colorsel_wheel_size_allocate (GtkWidget *frame,
}
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment