diff --git a/gui-lib/mred/private/wx/cocoa/canvas.rkt b/gui-lib/mred/private/wx/cocoa/canvas.rkt index 7b2858e1..8cc08151 100644 --- a/gui-lib/mred/private/wx/cocoa/canvas.rkt +++ b/gui-lib/mred/private/wx/cocoa/canvas.rkt @@ -265,7 +265,9 @@ [ignored-name #f] [gl-config #f]) - (inherit get-cocoa get-cocoa-window + (inherit get-cocoa + get-cocoa-window + get-wx-window get-eventspace make-graphics-context is-shown-to-root? @@ -319,7 +321,7 @@ (define/public (queue-paint) (void)) (define/public (request-canvas-flush-delay) (unless is-gl? - (request-flush-delay (get-cocoa-window)))) + (request-flush-delay (get-wx-window)))) (define/public (cancel-canvas-flush-delay req) (unless is-gl? (cancel-flush-delay req))) @@ -365,9 +367,6 @@ (define/public (end-refresh-sequence) (send dc resume-flush)) - (define/public (get-flush-window) - (get-cocoa-window)) - (define/private (refresh-one) (when is-gl? (tellv content-cocoa setNeedsDisplay: #:type _BOOL #t)) diff --git a/gui-lib/mred/private/wx/cocoa/frame.rkt b/gui-lib/mred/private/wx/cocoa/frame.rkt index 94dc002e..1aed1b4e 100644 --- a/gui-lib/mred/private/wx/cocoa/frame.rkt +++ b/gui-lib/mred/private/wx/cocoa/frame.rkt @@ -399,6 +399,22 @@ (sync/timeout 1 s)))))) (atomically (direct-show on?))) + + (define flush-disabled 0) + + (define/public (disable-flush-window) + (when (zero? flush-disabled) + (when (version-10.11-or-later?) + (tellv cocoa setAutodisplay: #:type _BOOL #f)) + (tellv cocoa disableFlushWindow)) + (set! flush-disabled (add1 flush-disabled))) + + (define/public (enable-flush-window) + (set! flush-disabled (sub1 flush-disabled)) + (when (zero? flush-disabled) + (tellv cocoa enableFlushWindow) + (when (version-10.11-or-later?) + (tellv cocoa setAutodisplay: #:type _BOOL #t)))) (define/public (force-window-focus) (let ([next (get-app-front-window)]) diff --git a/gui-lib/mred/private/wx/cocoa/window.rkt b/gui-lib/mred/private/wx/cocoa/window.rkt index 605ee3ed..a5f044a9 100644 --- a/gui-lib/mred/private/wx/cocoa/window.rkt +++ b/gui-lib/mred/private/wx/cocoa/window.rkt @@ -1008,21 +1008,21 @@ (when wx (queue-event (send wx get-eventspace) (lambda () (proc wx)))))) -(define (request-flush-delay cocoa-win) +(define (request-flush-delay wx-win) (do-request-flush-delay - cocoa-win - (lambda (cocoa-win) - (and (tell #:type _bool cocoa-win isVisible) - (tellv cocoa-win disableFlushWindow) + wx-win + (lambda (wx-win) + (and (tell #:type _bool (send wx-win get-cocoa-window) isVisible) + (send wx-win disable-flush-window) #t)) - (lambda (cocoa-win) - (tellv cocoa-win enableFlushWindow)))) + (lambda (wx-win) + (send wx-win enable-flush-window)))) (define (cancel-flush-delay req) (do-cancel-flush-delay req - (lambda (cocoa-win) - (tellv cocoa-win enableFlushWindow)))) + (lambda (wx-win) + (send wx-win enable-flush-window)))) (define (make-init-point x y) (make-NSPoint (if (not x)