[gtk+/gtk-2-24] quartz: fix corruption during scrolling in some cases



commit 3d5cd6e0553131bf7bec30e0524a66a4d481821b
Author: Kristian Rietveld <kris lanedo com>
Date:   Sun Aug 26 15:45:46 2012 +0200

    quartz: fix corruption during scrolling in some cases
    
    A call to scrollRect must be followed by a call to set that the offset
    rect needs display for the changes to "take effect". This was not
    done prior to this patch which, in some cases, caused corruption during
    scrolling.

 gdk/quartz/gdkdrawable-quartz.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index ac4887a..1bbf7c9 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -359,10 +359,17 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
        */
       if (drawable == (GdkDrawable *)window_impl)
         {
-          [window_impl->view scrollRect:NSMakeRect (xsrc, ysrc, width, height)
-                                     by:NSMakeSize (xdest - xsrc, ydest - ysrc)];
+          NSRect rect = NSMakeRect (xsrc, ysrc, width, height);
+          NSSize offset = NSMakeSize (xdest - xsrc, ydest - ysrc);
 
+          [window_impl->view scrollRect:rect by:offset];
 
+          /* The scrollRect only "takes effect" on the next redraw, we must
+           * set that the offset rectangle needs display.
+           */
+          rect.origin.x += offset.width;
+          rect.origin.y += offset.height;
+          [window_impl->view setNeedsDisplayInRect:rect];
         }
       else
         g_warning ("Drawing with window source != dest is not supported");



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