[gtk+] tests: Use a drawing area in motion-compression example
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tests: Use a drawing area in motion-compression example
- Date: Fri, 18 Nov 2016 20:46:41 +0000 (UTC)
commit fe23c3165ea13e5bc2b5bd750f866aa681913c45
Author: Benjamin Otte <otte redhat com>
Date: Fri Nov 18 15:09:36 2016 +0100
tests: Use a drawing area in motion-compression example
tests/motion-compression.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/tests/motion-compression.c b/tests/motion-compression.c
index 31512d6..e69956a 100644
--- a/tests/motion-compression.c
+++ b/tests/motion-compression.c
@@ -19,8 +19,11 @@ on_motion_notify (GtkWidget *window,
}
static void
-on_draw (GtkWidget *window,
- cairo_t *cr)
+on_draw (GtkDrawingArea *da,
+ cairo_t *cr,
+ int width,
+ int height,
+ gpointer data)
{
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
@@ -38,6 +41,7 @@ main (int argc, char **argv)
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *scale;
+ GtkWidget *da;
gtk_init (&argc, &argv);
@@ -56,10 +60,12 @@ main (int argc, char **argv)
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_box_pack_end (GTK_BOX (vbox), label, FALSE, FALSE);
+ da = gtk_drawing_area_new ();
+ gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL);
+ gtk_box_pack_end (GTK_BOX (vbox), da, TRUE, TRUE);
+
g_signal_connect (window, "motion-notify-event",
G_CALLBACK (on_motion_notify), NULL);
- g_signal_connect (window, "draw",
- G_CALLBACK (on_draw), NULL);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]