libgimpwidgets: slightly redo how GimpPickButton calls its new backends

to make porting to GTK+ 3.x easier, for less diff to the gtk3-port
branch.
This commit is contained in:
Michael Natterer 2015-10-06 23:44:36 +02:00
parent 1debefb20f
commit 30a86e38b8
3 changed files with 25 additions and 14 deletions

View File

@ -54,7 +54,7 @@ static void gimp_pick_button_pick (GdkScreen *screen,
gint y_root, gint y_root,
GimpPickButton *button); GimpPickButton *button);
void _gimp_pick_button_clicked (GtkButton *gtk_button); void _gimp_pick_button_default_pick (GimpPickButton *button);
static GdkCursor * static GdkCursor *
@ -226,14 +226,13 @@ gimp_pick_button_pick (GdkScreen *screen,
/* entry point to this file, called from gimppickbutton.c */ /* entry point to this file, called from gimppickbutton.c */
void void
_gimp_pick_button_clicked (GtkButton *gtk_button) _gimp_pick_button_default_pick (GimpPickButton *button)
{ {
GimpPickButton *button = GIMP_PICK_BUTTON (gtk_button); GtkWidget *widget;
GtkWidget *widget; guint32 timestamp;
guint32 timestamp;
if (! button->cursor) if (! button->cursor)
button->cursor = make_cursor (gtk_widget_get_display (GTK_WIDGET (gtk_button))); button->cursor = make_cursor (gtk_widget_get_display (GTK_WIDGET (button)));
if (! button->grab_widget) if (! button->grab_widget)
{ {

View File

@ -34,7 +34,7 @@
#endif #endif
void _gimp_pick_button_clicked (GtkButton *gtk_button); void _gimp_pick_button_quartz_pick (GimpPickButton *button);
@interface GimpPickWindowController : NSObject @interface GimpPickWindowController : NSObject
@ -398,11 +398,10 @@ void _gimp_pick_button_clicked (GtkButton *gtk_button);
} }
@end @end
/* entrypoint to this file, called from gimppickbutton.c */ /* entry point to this file, called from gimppickbutton.c */
void void
_gimp_pick_button_clicked (GtkButton *gtk_button) _gimp_pick_button_quartz_pick (GimpPickButton *button)
{ {
GimpPickButton *button = GIMP_PICK_BUTTON (gtk_button);
GimpPickWindowController *controller; GimpPickWindowController *controller;
NSAutoreleasePool *pool; NSAutoreleasePool *pool;

View File

@ -50,12 +50,15 @@ enum
LAST_SIGNAL LAST_SIGNAL
}; };
/* entry point to gimppickbutton-{default,quartz}.c */ /* entry points to gimppickbutton-{default,quartz}.c */
extern void _gimp_pick_button_clicked (GtkButton *gtk_button); void _gimp_pick_button_default_pick (GimpPickButton *button);
void _gimp_pick_button_quartz_pick (GimpPickButton *button);
static void gimp_pick_button_dispose (GObject *object); static void gimp_pick_button_dispose (GObject *object);
static void gimp_pick_button_clicked (GtkButton *button);
G_DEFINE_TYPE (GimpPickButton, gimp_pick_button, GTK_TYPE_BUTTON) G_DEFINE_TYPE (GimpPickButton, gimp_pick_button, GTK_TYPE_BUTTON)
#define parent_class gimp_pick_button_parent_class #define parent_class gimp_pick_button_parent_class
@ -88,7 +91,7 @@ gimp_pick_button_class_init (GimpPickButtonClass* klass)
object_class->dispose = gimp_pick_button_dispose; object_class->dispose = gimp_pick_button_dispose;
button_class->clicked = _gimp_pick_button_clicked; button_class->clicked = gimp_pick_button_clicked;
klass->color_picked = NULL; klass->color_picked = NULL;
} }
@ -129,6 +132,16 @@ gimp_pick_button_dispose (GObject *object)
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }
static void
gimp_pick_button_clicked (GtkButton *button)
{
#ifdef GDK_WINDOWING_QUARTZ
_gimp_pick_button_quartz_pick (GIMP_PICK_BUTTON (button));
#else
_gimp_pick_button_default_pick (GIMP_PICK_BUTTON (button));
#endif
}
/* public functions */ /* public functions */