From e9ff29537f739b20c75b166e8105f9883c581428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 13 Sep 2011 15:56:10 +0100 Subject: [PATCH 5/6] util/show-polygon: port to GTK3 Do not use colormaps and replace the "expose-event" with "draw" signal --- util/show-polygon.c | 20 ++------------------ 1 files changed, 2 insertions(+), 18 deletions(-) diff --git a/util/show-polygon.c b/util/show-polygon.c index f59e8ef..8153b85 100644 --- a/util/show-polygon.c +++ b/util/show-polygon.c @@ -293,21 +293,7 @@ polygon_view_draw (PolygonView *self, cairo_t *cr) } cairo_restore (cr); } -} - -static gboolean -polygon_view_expose (GtkWidget *w, GdkEventExpose *ev) -{ - PolygonView *self = (PolygonView *) w; - cairo_t *cr; - - cr = gdk_cairo_create (gtk_widget_get_window (w)); - gdk_cairo_region (cr, ev->region); - cairo_clip (cr); - polygon_view_draw (self, cr); - - cairo_destroy (cr); return FALSE; } @@ -417,7 +403,6 @@ polygon_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 | @@ -429,8 +414,7 @@ polygon_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); @@ -468,7 +452,7 @@ polygon_view_class_init (PolygonViewClass *klass) widget_class->realize = polygon_view_realize; widget_class->size_allocate = polygon_view_size_allocate; - widget_class->expose_event = polygon_view_expose; + widget_class->draw = polygon_view_draw; widget_class->key_press_event = polygon_view_key_press; widget_class->button_press_event = polygon_view_button_press; widget_class->button_release_event = polygon_view_button_release; -- 1.7.5.4