From 5e997b3981361cbdd06fc02ebd03aeca329ed104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 13 Sep 2011 15:58:02 +0100 Subject: [PATCH 6/6] util/show-traps: port to GTK3 Do not use colormaps and replace the "expose-event" with "draw" signal --- util/show-traps.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/util/show-traps.c b/util/show-traps.c index 7badad5..035604f 100644 --- a/util/show-traps.c +++ b/util/show-traps.c @@ -700,19 +700,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; } @@ -891,7 +886,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 | @@ -903,8 +897,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); @@ -942,7 +935,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