[gimp/gtk3-port: 88/130] libgimpwidgets: port to GtkWidget::draw()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 88/130] libgimpwidgets: port to GtkWidget::draw()
- Date: Fri, 19 Nov 2010 11:25:59 +0000 (UTC)
commit f8ee4fe8825a37c2df65c3175e9981536c444315
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 19 21:10:48 2010 +0200
libgimpwidgets: port to GtkWidget::draw()
libgimpwidgets/gimpcolorselect.c | 42 ++++++++++++-------------------------
1 files changed, 14 insertions(+), 28 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorselect.c b/libgimpwidgets/gimpcolorselect.c
index b516a1a..8d2c855 100644
--- a/libgimpwidgets/gimpcolorselect.c
+++ b/libgimpwidgets/gimpcolorselect.c
@@ -172,8 +172,8 @@ static void gimp_color_select_drop_color (GtkWidget *widget,
static void gimp_color_select_xy_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpColorSelect *select);
-static gboolean gimp_color_select_xy_expose (GtkWidget *widget,
- GdkEventExpose *eevent,
+static gboolean gimp_color_select_xy_draw (GtkWidget *widget,
+ cairo_t *cr,
GimpColorSelect *select);
static gboolean gimp_color_select_xy_events (GtkWidget *widget,
GdkEvent *event,
@@ -181,8 +181,8 @@ static gboolean gimp_color_select_xy_events (GtkWidget *widget,
static void gimp_color_select_z_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpColorSelect *select);
-static gboolean gimp_color_select_z_expose (GtkWidget *widget,
- GdkEventExpose *eevent,
+static gboolean gimp_color_select_z_draw (GtkWidget *widget,
+ cairo_t *cr,
GimpColorSelect *select);
static gboolean gimp_color_select_z_events (GtkWidget *widet,
GdkEvent *event,
@@ -274,8 +274,8 @@ gimp_color_select_init (GimpColorSelect *select)
g_signal_connect (select->xy_color, "size-allocate",
G_CALLBACK (gimp_color_select_xy_size_allocate),
select);
- g_signal_connect_after (select->xy_color, "expose-event",
- G_CALLBACK (gimp_color_select_xy_expose),
+ g_signal_connect_after (select->xy_color, "draw",
+ G_CALLBACK (gimp_color_select_xy_draw),
select);
g_signal_connect (select->xy_color, "event",
G_CALLBACK (gimp_color_select_xy_events),
@@ -302,8 +302,8 @@ gimp_color_select_init (GimpColorSelect *select)
g_signal_connect (select->z_color, "size-allocate",
G_CALLBACK (gimp_color_select_z_size_allocate),
select);
- g_signal_connect_after (select->z_color, "expose-event",
- G_CALLBACK (gimp_color_select_z_expose),
+ g_signal_connect_after (select->z_color, "draw",
+ G_CALLBACK (gimp_color_select_z_draw),
select);
g_signal_connect (select->z_color, "event",
G_CALLBACK (gimp_color_select_z_events),
@@ -614,20 +614,15 @@ gimp_color_select_xy_size_allocate (GtkWidget *widget,
}
static gboolean
-gimp_color_select_xy_expose (GtkWidget *widget,
- GdkEventExpose *event,
- GimpColorSelect *select)
+gimp_color_select_xy_draw (GtkWidget *widget,
+ cairo_t *cr,
+ GimpColorSelect *select)
{
GtkAllocation allocation;
- cairo_t *cr;
gint x, y;
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);
-
x = ((allocation.width - 1) * select->pos[0]) / 255;
y = (allocation.height - 1) - ((allocation.height - 1) * select->pos[1]) / 255;
@@ -645,8 +640,6 @@ gimp_color_select_xy_expose (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_stroke (cr);
- cairo_destroy (cr);
-
return TRUE;
}
@@ -741,20 +734,15 @@ gimp_color_select_z_size_allocate (GtkWidget *widget,
}
static gboolean
-gimp_color_select_z_expose (GtkWidget *widget,
- GdkEventExpose *event,
- GimpColorSelect *select)
+gimp_color_select_z_draw (GtkWidget *widget,
+ cairo_t *cr,
+ GimpColorSelect *select)
{
GtkAllocation allocation;
- cairo_t *cr;
gint y;
gtk_widget_get_allocation (widget, &allocation);
- cr = gdk_cairo_create (gtk_widget_get_window (widget));
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-
y = (allocation.height - 1) - ((allocation.height - 1) * select->pos[2]) / 255;
cairo_move_to (cr, 0, y + 0.5);
@@ -768,8 +756,6 @@ gimp_color_select_z_expose (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_stroke (cr);
- cairo_destroy (cr);
-
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]