33USING: accessors alien.c-types alien.data cocoa
44cocoa.application cocoa.classes cocoa.nibs cocoa.pasteboard
55cocoa.runtime cocoa.subclassing cocoa.views cocoa.windows
6- combinators core-foundation.run-loop core-foundation.strings
7- core-graphics core-graphics.types io.thread kernel literals math
8- math.bitwise math.rectangles namespaces sequences threads ui
6+ combinators continuations core-foundation.run-loop
7+ core-foundation.strings core-graphics core-graphics.types debugger
8+ io.thread kernel
9+ literals math math.bitwise math.rectangles namespaces sequences
10+ threads ui
911ui.backend ui.backend.cocoa.views ui.clipboards
1012ui.gadgets.worlds ui.pixel-formats ui.private ui.render ui.theme
1113ui.theme.switching ;
@@ -181,8 +183,12 @@ M: cocoa-ui-backend raise-window*
181183M: window-handle select-gl-context
182184 view>> -> openGLContext -> makeCurrentContext ;
183185
186+ : display-asleep? ( -- ? )
187+ CGMainDisplayID CGDisplayIsAsleep c-bool> ;
188+
184189M: window-handle flush-gl-context
185- view>> -> openGLContext -> flushBuffer ;
190+ display-asleep?
191+ [ drop ] [ view>> -> openGLContext -> flushBuffer ] if ;
186192
187193M: cocoa-ui-backend beep
188194 NSBeep ;
@@ -202,7 +208,8 @@ M: cocoa-ui-backend system-alert
202208
203209<CLASS: FactorApplicationDelegate < NSObject
204210
205- METHOD: void applicationDidUpdate: id obj [ reset-thread-timer ] ;
211+ METHOD: void applicationDidUpdate: id obj
212+ [ [ reset-thread-timer ] [ print-error ] recover ] ;
206213
207214 METHOD: char applicationShouldTerminateAfterLastWindowClosed: id app [
208215 ui-stop-after-last-window? get 1 0 ?
0 commit comments