[gtk+] tests: Use a drawing area in testpopup
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tests: Use a drawing area in testpopup
- Date: Fri, 18 Nov 2016 06:25:25 +0000 (UTC)
commit 3ee2138ee77b0d6ace8bfdf81cb64f3da01b7a5c
Author: Benjamin Otte <otte redhat com>
Date: Fri Nov 18 07:24:31 2016 +0100
tests: Use a drawing area in testpopup
tests/testpopup.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/tests/testpopup.c b/tests/testpopup.c
index bb126cb..98916c5 100644
--- a/tests/testpopup.c
+++ b/tests/testpopup.c
@@ -1,14 +1,14 @@
#include <gtk/gtk.h>
-static gboolean
-draw_popup (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
+static void
+draw_popup (GtkDrawingArea *da,
+ cairo_t *cr,
+ int width,
+ int height,
+ gpointer data)
{
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_paint (cr);
-
- return FALSE;
}
static gboolean
@@ -32,16 +32,18 @@ on_map_event (GtkWidget *parent,
GdkEvent *event,
gpointer data)
{
- GtkWidget *popup;
+ GtkWidget *popup, *da;
popup = gtk_window_new (GTK_WINDOW_POPUP);
+ da = gtk_drawing_area_new ();
+ gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_popup, NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (popup), da);
gtk_widget_set_size_request (GTK_WIDGET (popup), 20, 20);
gtk_window_set_transient_for (GTK_WINDOW (popup), GTK_WINDOW (parent));
- g_signal_connect (popup, "draw", G_CALLBACK (draw_popup), NULL);
g_signal_connect (parent, "motion-notify-event", G_CALLBACK (place_popup), popup);
- gtk_widget_show (popup);
+ gtk_widget_show_all (popup);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]