From 4b4c1fdbabc5c0cacdae2e187d1495f5fed4eeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 13 Sep 2011 15:32:55 +0100 Subject: [PATCH 4/6] util/show-events: port to GTK3 Do not use colormaps and replace the "expose-event" with "draw" signal --- util/show-events.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/util/show-events.c b/util/show-events.c index 484e248..e6efa1c 100644 --- a/util/show-events.c +++ b/util/show-events.c @@ -386,19 +386,14 @@ event_view_draw_labels (EventView *self, cairo_t *cr) } static gboolean -event_view_expose (GtkWidget *w, GdkEventExpose *ev) +event_view_draw_signal (GtkWidget *w, + cairo_t *cr) { EventView *self = (EventView *) w; - cairo_t *cr; - - cr = gdk_cairo_create (gtk_widget_get_window (w)); - gdk_cairo_region (cr, ev->region); - cairo_clip (cr); event_view_draw (self, cr); event_view_draw_labels (self, cr); - cairo_destroy (cr); return FALSE; } @@ -572,7 +567,6 @@ event_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 | @@ -584,8 +578,7 @@ event_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); @@ -623,7 +616,7 @@ event_view_class_init (EventViewClass *klass) widget_class->realize = event_view_realize; widget_class->size_allocate = event_view_size_allocate; - widget_class->expose_event = event_view_expose; + widget_class->draw = event_view_draw_signal; widget_class->button_press_event = event_view_button_press; widget_class->button_release_event = event_view_button_release; widget_class->motion_notify_event = event_view_motion; -- 1.7.5.4