[gimp/gtk3-port: 23/223] 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/223] app: port to GtkWidget::draw() and s/GtkObject/GtkAdjustment/
- Date: Fri, 25 Nov 2011 21:36:19 +0000 (UTC)
commit 218a6bc4668922190deed6c46a976e8e27429846
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 fbafe12..13212ed 100644
--- a/app/widgets/gimpgradienteditor.c
+++ b/app/widgets/gimpgradienteditor.c
@@ -159,8 +159,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,
@@ -201,7 +201,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,
@@ -352,8 +352,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]