libgimpwidgets: port to GtkWidget::draw()

This commit is contained in:
Michael Natterer 2010-10-19 21:10:48 +02:00
parent 86e033d495
commit 4477ad84de
1 changed files with 14 additions and 32 deletions

View File

@ -218,8 +218,8 @@ static void gimp_color_select_drop_color (GtkWidget *widget,
static void gimp_color_select_xy_size_allocate (GtkWidget *widget, static void gimp_color_select_xy_size_allocate (GtkWidget *widget,
GtkAllocation *allocation, GtkAllocation *allocation,
GimpColorSelect *select); GimpColorSelect *select);
static gboolean gimp_color_select_xy_expose (GtkWidget *widget, static gboolean gimp_color_select_xy_draw (GtkWidget *widget,
GdkEventExpose *eevent, cairo_t *cr,
GimpColorSelect *select); GimpColorSelect *select);
static gboolean gimp_color_select_xy_events (GtkWidget *widget, static gboolean gimp_color_select_xy_events (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
@ -227,8 +227,8 @@ static gboolean gimp_color_select_xy_events (GtkWidget *widget,
static void gimp_color_select_z_size_allocate (GtkWidget *widget, static void gimp_color_select_z_size_allocate (GtkWidget *widget,
GtkAllocation *allocation, GtkAllocation *allocation,
GimpColorSelect *select); GimpColorSelect *select);
static gboolean gimp_color_select_z_expose (GtkWidget *widget, static gboolean gimp_color_select_z_draw (GtkWidget *widget,
GdkEventExpose *eevent, cairo_t *cr,
GimpColorSelect *select); GimpColorSelect *select);
static gboolean gimp_color_select_z_events (GtkWidget *widget, static gboolean gimp_color_select_z_events (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
@ -380,8 +380,8 @@ gimp_color_select_init (GimpColorSelect *select)
g_signal_connect (select->xy_color, "size-allocate", g_signal_connect (select->xy_color, "size-allocate",
G_CALLBACK (gimp_color_select_xy_size_allocate), G_CALLBACK (gimp_color_select_xy_size_allocate),
select); select);
g_signal_connect_after (select->xy_color, "expose-event", g_signal_connect_after (select->xy_color, "draw",
G_CALLBACK (gimp_color_select_xy_expose), G_CALLBACK (gimp_color_select_xy_draw),
select); select);
g_signal_connect (select->xy_color, "event", g_signal_connect (select->xy_color, "event",
G_CALLBACK (gimp_color_select_xy_events), G_CALLBACK (gimp_color_select_xy_events),
@ -411,8 +411,8 @@ gimp_color_select_init (GimpColorSelect *select)
g_signal_connect (select->z_color, "size-allocate", g_signal_connect (select->z_color, "size-allocate",
G_CALLBACK (gimp_color_select_z_size_allocate), G_CALLBACK (gimp_color_select_z_size_allocate),
select); select);
g_signal_connect_after (select->z_color, "expose-event", g_signal_connect_after (select->z_color, "draw",
G_CALLBACK (gimp_color_select_z_expose), G_CALLBACK (gimp_color_select_z_draw),
select); select);
g_signal_connect (select->z_color, "event", g_signal_connect (select->z_color, "event",
G_CALLBACK (gimp_color_select_z_events), G_CALLBACK (gimp_color_select_z_events),
@ -890,12 +890,11 @@ gimp_color_select_xy_size_allocate (GtkWidget *widget,
} }
static gboolean static gboolean
gimp_color_select_xy_expose (GtkWidget *widget, gimp_color_select_xy_draw (GtkWidget *widget,
GdkEventExpose *event, cairo_t *cr,
GimpColorSelect *select) GimpColorSelect *select)
{ {
GtkAllocation allocation; GtkAllocation allocation;
cairo_t *cr;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
gint x, y; gint x, y;
@ -964,12 +963,6 @@ gimp_color_select_xy_expose (GtkWidget *widget,
gtk_widget_get_allocation (select->xy_color, &allocation); gtk_widget_get_allocation (select->xy_color, &allocation);
cr = gdk_cairo_create (gtk_widget_get_window (widget));
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
cairo_translate (cr, allocation.x, allocation.y);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
g_object_unref (pixbuf); g_object_unref (pixbuf);
cairo_paint (cr); cairo_paint (cr);
@ -991,8 +984,6 @@ gimp_color_select_xy_expose (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8); cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_stroke (cr); cairo_stroke (cr);
cairo_destroy (cr);
return TRUE; return TRUE;
} }
@ -1096,12 +1087,11 @@ gimp_color_select_z_size_allocate (GtkWidget *widget,
} }
static gboolean static gboolean
gimp_color_select_z_expose (GtkWidget *widget, gimp_color_select_z_draw (GtkWidget *widget,
GdkEventExpose *event, cairo_t *cr,
GimpColorSelect *select) GimpColorSelect *select)
{ {
GtkAllocation allocation; GtkAllocation allocation;
cairo_t *cr;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
gint y; gint y;
@ -1126,10 +1116,6 @@ gimp_color_select_z_expose (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
cr = gdk_cairo_create (gtk_widget_get_window (widget));
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
if (! select->transform) if (! select->transform)
gimp_color_select_create_transform (select); gimp_color_select_create_transform (select);
@ -1174,8 +1160,6 @@ gimp_color_select_z_expose (GtkWidget *widget,
NULL, NULL); NULL, NULL);
} }
cairo_translate (cr, allocation.x, allocation.y);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
g_object_unref (pixbuf); g_object_unref (pixbuf);
cairo_paint (cr); cairo_paint (cr);
@ -1193,8 +1177,6 @@ gimp_color_select_z_expose (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8); cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_stroke (cr); cairo_stroke (cr);
cairo_destroy (cr);
return TRUE; return TRUE;
} }