[gimp] plug-ins: move the expose handler to map-pbject-preview.c



commit 491e55c4e426c0ae6fe6a3f0c96dc4df8cb41cc9
Author: Michael Natterer <mitch gimp org>
Date:   Sun Feb 13 14:16:32 2011 +0100

    plug-ins: move the expose handler to map-pbject-preview.c

 plug-ins/map-object/map-object-preview.c |    9 ++++++---
 plug-ins/map-object/map-object-preview.h |   13 +++++++------
 plug-ins/map-object/map-object-ui.c      |    8 ++++----
 3 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/plug-ins/map-object/map-object-preview.c b/plug-ins/map-object/map-object-preview.c
index 7d39342..f0f7d31 100644
--- a/plug-ins/map-object/map-object-preview.c
+++ b/plug-ins/map-object/map-object-preview.c
@@ -360,14 +360,15 @@ compute_preview_image (void)
   clear_light_marker ();
 }
 
-void
-draw_preview_image (void)
+gboolean
+preview_expose (GtkWidget      *widget,
+                GdkEventExpose *eevent)
 {
   gint startx, starty, pw, ph;
   GdkColor  color;
   cairo_t *cr;
 
-  cr = gdk_cairo_create (gtk_widget_get_window (previewarea));
+  cr = gdk_cairo_create (eevent->window);
 
   color.red   = 0xFFFF;
   color.green = 0xFFFF;
@@ -388,4 +389,6 @@ draw_preview_image (void)
   draw_lights (startx, starty, pw, ph);
 
   cairo_destroy (cr);
+
+  return FALSE;
 }
diff --git a/plug-ins/map-object/map-object-preview.h b/plug-ins/map-object/map-object-preview.h
index 46d4e25..bd2b20c 100644
--- a/plug-ins/map-object/map-object-preview.h
+++ b/plug-ins/map-object/map-object-preview.h
@@ -13,11 +13,12 @@ extern gint       lightx,lighty;
 /* Externally visible functions */
 /* ============================ */
 
-void compute_preview_image  (void);
-void draw_preview_image     (void);
-gint check_light_hit        (gint xpos,
-			     gint ypos);
-void update_light           (gint xpos,
-			     gint ypos);
+void     compute_preview_image  (void);
+gboolean preview_expose         (GtkWidget      *widget,
+                                 GdkEventExpose *eevent);
+gint     check_light_hit        (gint            xpos,
+                                 gint            ypos);
+void     update_light           (gint            xpos,
+                                 gint            ypos);
 
 #endif  /* __MAPOBJECT_PREVIEW_H__ */
diff --git a/plug-ins/map-object/map-object-ui.c b/plug-ins/map-object/map-object-ui.c
index d07c829..bdc7656 100644
--- a/plug-ins/map-object/map-object-ui.c
+++ b/plug-ins/map-object/map-object-ui.c
@@ -299,10 +299,6 @@ preview_events (GtkWidget *area,
 
   switch (event->type)
     {
-      case GDK_EXPOSE:
-        draw_preview_image ();
-        break;
-
       case GDK_ENTER_NOTIFY:
         break;
 
@@ -1319,6 +1315,10 @@ main_dialog (GimpDrawable *drawable)
                     G_CALLBACK (preview_events),
                     previewarea);
 
+  g_signal_connect (previewarea, "expose-event",
+                    G_CALLBACK (preview_expose),
+                    previewarea);
+
   hbox = gtk_hbox_new (FALSE, 6);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]