From 1ac79a26d3f64561ffbf013277cc9a30edc222f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 13 Sep 2011 15:29:59 +0100 Subject: [PATCH 3/6] util/show-edges: port to GTK3 Do not use colormaps and replace the "expose-event" with "draw" signal --- util/show-edges.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/util/show-edges.c b/util/show-edges.c index 8ae44a2..ba82cbd 100644 --- a/util/show-edges.c +++ b/util/show-edges.c @@ -706,19 +706,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; } @@ -895,7 +890,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 | @@ -907,8 +901,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); @@ -946,7 +939,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