ui.backend: adding ui-stop-after-last-window?.

This defaults to true, except for the "ui.tools".  Also, this only
works on macOS right now.  Linux and Windows always stop after the
last window closes.
char-rename
John Benediktsson 2017-03-05 14:51:33 -08:00
parent 44da4ed4dd
commit 96a0c30baf
3 changed files with 17 additions and 5 deletions

View File

@ -5,6 +5,9 @@ IN: ui.backend
SYMBOL: ui-backend
SYMBOL: ui-stop-after-last-window?
ui-stop-after-last-window? [ t ] initialize
HOOK: set-title ui-backend ( string world -- )
HOOK: (set-fullscreen) ui-backend ( world ? -- )

View File

@ -196,7 +196,12 @@ M: cocoa-ui-backend system-alert
] [ 2drop ] if* ;
CLASS: FactorApplicationDelegate < NSObject
METHOD: void applicationDidUpdate: id obj [ reset-thread-timer ] ;
METHOD: char applicationShouldTerminateAfterLastWindowClosed: id app [
ui-stop-after-last-window? get 1 0 ?
] ;
;
: install-app-delegate ( -- )

View File

@ -1,12 +1,10 @@
! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: memory system ui ui.commands ui.gestures ui.tools.browser
ui.tools.common ui.tools.error-list ui.tools.listener
vocabs.refresh ;
USING: memory namespaces system ui ui.backend ui.commands
ui.gestures ui.tools.browser ui.tools.common
ui.tools.error-list ui.tools.listener vocabs.refresh ;
IN: ui.tools
MAIN: listener-window
\ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
\ save H{ { +nullary+ t } } define-command
@ -29,3 +27,9 @@ tool "common" f {
{ T{ key-down f f "F2" } refresh-all }
{ T{ key-down f f "F3" } show-error-list }
} define-command-map
: ui-tools-main ( -- )
f ui-stop-after-last-window? set-global
listener-window ;
MAIN: ui-tools-main