Mac OS X 10.11: disable auto-update for suspended-flush windows
Previous versions of OS X seem to have automatically disabled update for a window when flushing is disabled, but now we have to do it ourselves, otherwise text editors can flicker a lot. (The system change is probably related to the removal of the `isFlushWindowDisabled` method of `NSWindow` (which was deprecated in 10.10).
This commit is contained in:
parent
52ac3da7bd
commit
ea576d3177
|
@ -265,7 +265,9 @@
|
||||||
[ignored-name #f]
|
[ignored-name #f]
|
||||||
[gl-config #f])
|
[gl-config #f])
|
||||||
|
|
||||||
(inherit get-cocoa get-cocoa-window
|
(inherit get-cocoa
|
||||||
|
get-cocoa-window
|
||||||
|
get-wx-window
|
||||||
get-eventspace
|
get-eventspace
|
||||||
make-graphics-context
|
make-graphics-context
|
||||||
is-shown-to-root?
|
is-shown-to-root?
|
||||||
|
@ -319,7 +321,7 @@
|
||||||
(define/public (queue-paint) (void))
|
(define/public (queue-paint) (void))
|
||||||
(define/public (request-canvas-flush-delay)
|
(define/public (request-canvas-flush-delay)
|
||||||
(unless is-gl?
|
(unless is-gl?
|
||||||
(request-flush-delay (get-cocoa-window))))
|
(request-flush-delay (get-wx-window))))
|
||||||
(define/public (cancel-canvas-flush-delay req)
|
(define/public (cancel-canvas-flush-delay req)
|
||||||
(unless is-gl?
|
(unless is-gl?
|
||||||
(cancel-flush-delay req)))
|
(cancel-flush-delay req)))
|
||||||
|
@ -365,9 +367,6 @@
|
||||||
(define/public (end-refresh-sequence)
|
(define/public (end-refresh-sequence)
|
||||||
(send dc resume-flush))
|
(send dc resume-flush))
|
||||||
|
|
||||||
(define/public (get-flush-window)
|
|
||||||
(get-cocoa-window))
|
|
||||||
|
|
||||||
(define/private (refresh-one)
|
(define/private (refresh-one)
|
||||||
(when is-gl?
|
(when is-gl?
|
||||||
(tellv content-cocoa setNeedsDisplay: #:type _BOOL #t))
|
(tellv content-cocoa setNeedsDisplay: #:type _BOOL #t))
|
||||||
|
|
|
@ -400,6 +400,22 @@
|
||||||
(atomically
|
(atomically
|
||||||
(direct-show on?)))
|
(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)
|
(define/public (force-window-focus)
|
||||||
(let ([next (get-app-front-window)])
|
(let ([next (get-app-front-window)])
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -1008,21 +1008,21 @@
|
||||||
(when wx
|
(when wx
|
||||||
(queue-event (send wx get-eventspace) (lambda () (proc 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
|
(do-request-flush-delay
|
||||||
cocoa-win
|
wx-win
|
||||||
(lambda (cocoa-win)
|
(lambda (wx-win)
|
||||||
(and (tell #:type _bool cocoa-win isVisible)
|
(and (tell #:type _bool (send wx-win get-cocoa-window) isVisible)
|
||||||
(tellv cocoa-win disableFlushWindow)
|
(send wx-win disable-flush-window)
|
||||||
#t))
|
#t))
|
||||||
(lambda (cocoa-win)
|
(lambda (wx-win)
|
||||||
(tellv cocoa-win enableFlushWindow))))
|
(send wx-win enable-flush-window))))
|
||||||
|
|
||||||
(define (cancel-flush-delay req)
|
(define (cancel-flush-delay req)
|
||||||
(do-cancel-flush-delay
|
(do-cancel-flush-delay
|
||||||
req
|
req
|
||||||
(lambda (cocoa-win)
|
(lambda (wx-win)
|
||||||
(tellv cocoa-win enableFlushWindow))))
|
(send wx-win enable-flush-window))))
|
||||||
|
|
||||||
(define (make-init-point x y)
|
(define (make-init-point x y)
|
||||||
(make-NSPoint (if (not x)
|
(make-NSPoint (if (not x)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user