[gimp/gtk3-port: 79/235] libgimpwidgets: port to GtkWidget::draw()



commit 7e144452f0c17dd00fb84a13e0346f9caec67916
Author: Michael Natterer <mitch gimp org>
Date:   Thu Oct 21 13:06:32 2010 +0200

    libgimpwidgets: port to GtkWidget::draw()

 libgimpwidgets/gimpscrolledpreview.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)
---
diff --git a/libgimpwidgets/gimpscrolledpreview.c b/libgimpwidgets/gimpscrolledpreview.c
index b0097db..33f0840 100644
--- a/libgimpwidgets/gimpscrolledpreview.c
+++ b/libgimpwidgets/gimpscrolledpreview.c
@@ -90,8 +90,8 @@ static gboolean  gimp_scrolled_preview_nav_button_press    (GtkWidget
 static gboolean  gimp_scrolled_preview_nav_popup_event     (GtkWidget                *widget,
                                                             GdkEvent                 *event,
                                                             GimpScrolledPreview      *preview);
-static gboolean  gimp_scrolled_preview_nav_popup_expose    (GtkWidget                *widget,
-                                                            GdkEventExpose           *event,
+static gboolean  gimp_scrolled_preview_nav_popup_draw      (GtkWidget                *widget,
+                                                            cairo_t                  *cr,
                                                             GimpScrolledPreview      *preview);
 
 static void      gimp_scrolled_preview_set_cursor          (GimpPreview              *preview);
@@ -594,8 +594,8 @@ gimp_scrolled_preview_nav_button_press (GtkWidget           *widget,
       g_signal_connect (area, "event",
                         G_CALLBACK (gimp_scrolled_preview_nav_popup_event),
                         preview);
-      g_signal_connect_after (area, "expose-event",
-                              G_CALLBACK (gimp_scrolled_preview_nav_popup_expose),
+      g_signal_connect_after (area, "draw",
+                              G_CALLBACK (gimp_scrolled_preview_nav_popup_draw),
                               preview);
 
       GIMP_PREVIEW_GET_CLASS (preview)->draw_thumb (gimp_preview,
@@ -720,13 +720,12 @@ gimp_scrolled_preview_nav_popup_event (GtkWidget           *widget,
 }
 
 static gboolean
-gimp_scrolled_preview_nav_popup_expose (GtkWidget           *widget,
-                                        GdkEventExpose      *event,
-                                        GimpScrolledPreview *preview)
+gimp_scrolled_preview_nav_popup_draw (GtkWidget           *widget,
+                                      cairo_t             *cr,
+                                      GimpScrolledPreview *preview)
 {
   GtkAdjustment *adj;
   GtkAllocation  allocation;
-  cairo_t       *cr;
   gdouble        x, y;
   gdouble        w, h;
 
@@ -758,14 +757,7 @@ gimp_scrolled_preview_nav_popup_expose (GtkWidget           *widget,
   w = MAX (1, ceil (w * (gdouble) allocation.width));
   h = MAX (1, ceil (h * (gdouble) allocation.height));
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
-
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-
-  cairo_rectangle (cr,
-                   0, 0, allocation.width, allocation.height);
-
+  cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
   cairo_rectangle (cr, x, y, w, h);
 
   cairo_set_source_rgba (cr, 0, 0, 0, 0.5);
@@ -778,8 +770,6 @@ gimp_scrolled_preview_nav_popup_expose (GtkWidget           *widget,
   cairo_set_line_width (cr, 2);
   cairo_stroke (cr);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 



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