From 4a8ea9730ecd639823f2b9410097e23121d20ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 13 Sep 2011 15:25:15 +0100 Subject: [PATCH 2/6] util/show-contour: port to GTK3 Do not use colormaps and replace the "expose-event" with "draw" signal --- configure.ac | 2 +- util/show-contour.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 5879a44..a64dcfc 100644 --- a/configure.ac +++ b/configure.ac @@ -791,7 +791,7 @@ AM_CONDITIONAL(BUILD_CXX, test "x$need_cxx" = "xyes") dnl =========================================================================== # We use GTK+ for some utility/debugging tools -PKG_CHECK_MODULES(gtk, "gtk+-2.0",have_gtk=yes, have_gtk=no) +PKG_CHECK_MODULES(gtk, "gtk+-3.0",have_gtk=yes, have_gtk=no) AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes") AC_CONFIG_FILES([ diff --git a/util/show-contour.c b/util/show-contour.c index 72d9d9a..e7d9d09 100644 --- a/util/show-contour.c +++ b/util/show-contour.c @@ -377,19 +377,14 @@ trap_view_draw_labels (TrapView *self, cairo_t *cr) } static gboolean -trap_view_expose (GtkWidget *w, GdkEventExpose *ev) +trap_view_draw_signal (GtkWidget *w, + cairo_t *cr) { TrapView *self = (TrapView *) w; - cairo_t *cr; - - cr = gdk_cairo_create (gtk_widget_get_window (w)); - gdk_cairo_region (cr, ev->region); - cairo_clip (cr); trap_view_draw (self, cr); trap_view_draw_labels (self, cr); - cairo_destroy (cr); return FALSE; } @@ -499,7 +494,6 @@ trap_view_realize (GtkWidget *widget) attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = gtk_widget_get_events (widget) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -511,8 +505,7 @@ trap_view_realize (GtkWidget *widget) gdk_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, - GDK_WA_X | GDK_WA_Y | - GDK_WA_VISUAL | GDK_WA_COLORMAP); + GDK_WA_X | GDK_WA_Y); gtk_widget_set_window (widget, gdk_window); gdk_window_set_user_data (gdk_window, widget); @@ -550,7 +543,7 @@ trap_view_class_init (TrapViewClass *klass) widget_class->realize = trap_view_realize; widget_class->size_allocate = trap_view_size_allocate; - widget_class->expose_event = trap_view_expose; + widget_class->draw = trap_view_draw_signal; widget_class->key_press_event = trap_view_key_press; widget_class->button_press_event = trap_view_button_press; widget_class->button_release_event = trap_view_button_release; -- 1.7.5.4