diff --git a/collects/mred/private/wx/cocoa/canvas.rkt b/collects/mred/private/wx/cocoa/canvas.rkt index 7fe6d67ae2..02b2672132 100644 --- a/collects/mred/private/wx/cocoa/canvas.rkt +++ b/collects/mred/private/wx/cocoa/canvas.rkt @@ -280,10 +280,13 @@ (queue-window-refresh-event this thunk)) (define/public (paint-or-queue-paint) - (or (do-canvas-backing-flush #f) - (begin - (queue-paint) - #f))) + (cond + [is-gl? (do-canvas-backing-flush #f) + (queue-paint) + #t] + [(do-canvas-backing-flush #f) #t] + [else (queue-paint) + #f])) (define/public (do-canvas-backing-flush ctx) (do-backing-flush this dc (tell NSGraphicsContext currentContext) diff --git a/collects/mred/private/wx/cocoa/dc.rkt b/collects/mred/private/wx/cocoa/dc.rkt index cb81eb3e8f..a04391c39a 100644 --- a/collects/mred/private/wx/cocoa/dc.rkt +++ b/collects/mred/private/wx/cocoa/dc.rkt @@ -20,6 +20,7 @@ do-backing-flush)) (import-class NSOpenGLContext) +(define NSOpenGLCPSwapInterval 222) (define dc% (class backing-dc% @@ -44,6 +45,14 @@ (define/override (do-swap-buffers) (tellv gl-ctx flushBuffer)) (super-new)))]) + ;; Disable screen sync for GL flushBuffer; otherwise, + ;; flushBuffer can take around 10 msec depending on the timing + ;; of event polling, and that can be bad for examples like gears. + ;; Maybe whether to sync with the screen should be a configuration + ;; option, but I can't tell the difference on my screen. + (tellv gl-ctx setValues: + #:type (_ptr i _long) 0 + forParameter: #:type _int NSOpenGLCPSwapInterval) (set! gl g) g)))))