[gimp/gtk3-port: 23/227] app: port to GtkWidget::draw() and s/GtkObject/GtkAdjustment/
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 23/227] app: port to GtkWidget::draw() and s/GtkObject/GtkAdjustment/
- Date: Fri, 26 Apr 2013 21:04:50 +0000 (UTC)
commit 776101d1b42a75e0401437841f5ff34dbc95b6ff
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 15 14:19:42 2010 +0200
app: port to GtkWidget::draw() and s/GtkObject/GtkAdjustment/
app/widgets/gimpgradienteditor.c | 52 +++++++++++++++++--------------------
1 files changed, 24 insertions(+), 28 deletions(-)
---
diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c
index dbe1d08..e5a3cb4 100644
--- a/app/widgets/gimpgradienteditor.c
+++ b/app/widgets/gimpgradienteditor.c
@@ -160,8 +160,8 @@ static void view_pick_color (GimpGradientEditor *editor,
static gboolean control_events (GtkWidget *widget,
GdkEvent *event,
GimpGradientEditor *editor);
-static gboolean control_expose (GtkWidget *widget,
- GdkEventExpose *event,
+static gboolean control_draw (GtkWidget *widget,
+ cairo_t *cr,
GimpGradientEditor *editor);
static void control_do_hint (GimpGradientEditor *editor,
gint x,
@@ -202,7 +202,7 @@ static double control_move (GimpGradientEditor *editor,
static void control_update (GimpGradientEditor *editor,
GimpGradient *gradient,
gboolean recalculate);
-static void control_draw (GimpGradientEditor *editor,
+static void control_draw_all (GimpGradientEditor *editor,
GimpGradient *gradient,
cairo_t *cr,
gint width,
@@ -353,8 +353,8 @@ gimp_gradient_editor_init (GimpGradientEditor *editor)
G_CALLBACK (control_events),
editor);
- g_signal_connect (editor->control, "expose-event",
- G_CALLBACK (control_expose),
+ g_signal_connect (editor->control, "draw",
+ G_CALLBACK (control_draw),
editor);
gimp_dnd_color_dest_add (GTK_WIDGET (editor->control),
@@ -1073,8 +1073,7 @@ control_events (GtkWidget *widget,
else
{
GtkAdjustment *adj = editor->scroll_data;
-
- gfloat new_value;
+ gfloat new_value;
new_value = (gtk_adjustment_get_value (adj) +
((sevent->direction == GDK_SCROLL_UP) ?
@@ -1175,26 +1174,23 @@ control_events (GtkWidget *widget,
}
static gboolean
-control_expose (GtkWidget *widget,
- GdkEventExpose *event,
- GimpGradientEditor *editor)
+control_draw (GtkWidget *widget,
+ cairo_t *cr,
+ GimpGradientEditor *editor)
{
GtkAdjustment *adj = editor->scroll_data;
- cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
- control_draw (editor,
- GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data),
- cr,
- allocation.width,
- allocation.height,
- gtk_adjustment_get_value (adj),
- gtk_adjustment_get_value (adj) +
- gtk_adjustment_get_page_size (adj));
-
- cairo_destroy (cr);
+ control_draw_all (editor,
+ GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data),
+ cr,
+ allocation.width,
+ allocation.height,
+ gtk_adjustment_get_value (adj),
+ gtk_adjustment_get_value (adj) +
+ gtk_adjustment_get_page_size (adj));
return TRUE;
}
@@ -1685,13 +1681,13 @@ control_update (GimpGradientEditor *editor,
}
static void
-control_draw (GimpGradientEditor *editor,
- GimpGradient *gradient,
- cairo_t *cr,
- gint width,
- gint height,
- gdouble left,
- gdouble right)
+control_draw_all (GimpGradientEditor *editor,
+ GimpGradient *gradient,
+ cairo_t *cr,
+ gint width,
+ gint height,
+ gdouble left,
+ gdouble right)
{
GtkStyle *control_style;
GimpGradientSegment *seg;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]