[gimp/gtk3-port: 83/237] libgimpwidgets: port to GtkWidget::draw()



commit 9392091cb39751b5baac80d0447a7d1a518b2435
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 89d72e6..55fa820 100644
--- a/libgimpwidgets/gimpscrolledpreview.c
+++ b/libgimpwidgets/gimpscrolledpreview.c
@@ -87,8 +87,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);
@@ -591,8 +591,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,
@@ -717,13 +717,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;
 
@@ -755,14 +754,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);
@@ -775,8 +767,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]