diff --git a/basis/ui/backend/cocoa/cocoa.factor b/basis/ui/backend/cocoa/cocoa.factor index 94a104ee5e..5c6189fc6f 100644 --- a/basis/ui/backend/cocoa/cocoa.factor +++ b/basis/ui/backend/cocoa/cocoa.factor @@ -13,8 +13,7 @@ ui.gadgets.worlds ui.pixel-formats ui.pixel-formats.private ui.private words.symbol ; IN: ui.backend.cocoa -TUPLE: handle ; -TUPLE: window-handle < handle view window ; +TUPLE: window-handle view window ; C: window-handle @@ -144,7 +143,7 @@ M:: cocoa-ui-backend (open-window) ( world -- ) window install-window-delegate view window world handle<< window f -> makeKeyAndOrderFront: - 100 world active?<< ; + t world active?<< ; M: cocoa-ui-backend (close-window) ( handle -- ) [ @@ -180,19 +179,17 @@ M: cocoa-ui-backend raise-window* ( world -- ) NSApp 1 -> activateIgnoringOtherApps: ] when* ; -GENERIC: (gl-context) ( handle -- context ) -M: window-handle (gl-context) view>> -> openGLContext ; +M: window-handle select-gl-context ( handle -- ) + view>> -> openGLContext -> makeCurrentContext ; -M: handle select-gl-context ( handle -- ) - (gl-context) -> makeCurrentContext ; - -M: handle flush-gl-context ( handle -- ) - (gl-context) -> flushBuffer ; +M: window-handle flush-gl-context ( handle -- ) + view>> -> openGLContext -> flushBuffer ; M: cocoa-ui-backend beep ( -- ) NSBeep ; -M: cocoa-ui-backend resize-window [ handle>> window>> ] [ first2 ] bi* -> setContentSize: ; +M: cocoa-ui-backend resize-window + [ handle>> window>> ] [ first2 ] bi* -> setContentSize: ; M: cocoa-ui-backend system-alert NSAlert -> alloc -> init -> autorelease [ diff --git a/basis/ui/backend/gtk/gtk.factor b/basis/ui/backend/gtk/gtk.factor index 3ad7650412..d35b681af0 100644 --- a/basis/ui/backend/gtk/gtk.factor +++ b/basis/ui/backend/gtk/gtk.factor @@ -229,14 +229,14 @@ CONSTANT: action-key-codes 2drop window relayout t ; : on-configure ( win event user-data -- ? ) - drop swap window dup active?>> 100 = [ + drop swap window dup active?>> [ swap GdkEventConfigure memory>struct [ event-loc >>window-loc ] [ event-dim >>dim ] bi relayout-1 ] [ 2drop ] if f ; : on-map ( win event user-data -- ? ) - 2drop window 100 >>active? drop t ; + 2drop window t >>active? drop t ; : on-delete ( win event user-data -- ? ) 2drop window ungraft t ; diff --git a/basis/ui/backend/windows/windows.factor b/basis/ui/backend/windows/windows.factor index ffee457b19..9bf7af30ed 100755 --- a/basis/ui/backend/windows/windows.factor +++ b/basis/ui/backend/windows/windows.factor @@ -271,7 +271,7 @@ CONSTANT: window-control>ex-style : handle-wm-paint ( hWnd uMsg wParam lParam -- ) ! wParam and lParam are unused ! only paint if width/height both > 0 - 3drop window 100 >>active? relayout-1 yield ; + 3drop window t >>active? relayout-1 yield ; : handle-wm-size ( hWnd uMsg wParam lParam -- ) 2nip @@ -411,9 +411,9 @@ CONSTANT: exclude-keys-wm-char : handle-wm-syscommand ( hWnd uMsg wParam lParam -- n ) { - { [ over SC_MINIMIZE = ] [ 0 set-window-active ] } - { [ over SC_RESTORE = ] [ 100 set-window-active ] } - { [ over SC_MAXIMIZE = ] [ 100 set-window-active ] } + { [ over SC_MINIMIZE = ] [ f set-window-active ] } + { [ over SC_RESTORE = ] [ t set-window-active ] } + { [ over SC_MAXIMIZE = ] [ t set-window-active ] } { [ dup alpha? ] [ 4drop 0 ] } { [ t ] [ DefWindowProc ] } } cond ; diff --git a/basis/ui/backend/x11/x11.factor b/basis/ui/backend/x11/x11.factor index ef22ab9cfc..1535616102 100644 --- a/basis/ui/backend/x11/x11.factor +++ b/basis/ui/backend/x11/x11.factor @@ -57,7 +57,7 @@ M: world expose-event nip relayout ; M: world configure-event swap [ event-loc >>window-loc ] [ event-dim >>dim ] bi - 100 >>active? + t >>active? ! In case dimensions didn't change relayout-1 ; diff --git a/basis/ui/gadgets/worlds/worlds.factor b/basis/ui/gadgets/worlds/worlds.factor index 5004ede420..6eab0951ff 100644 --- a/basis/ui/gadgets/worlds/worlds.factor +++ b/basis/ui/gadgets/worlds/worlds.factor @@ -118,7 +118,7 @@ M: world request-focus-on ( child gadget -- ) : new-world ( class -- world ) vertical swap new-track t >>root? - 0 >>active? + f >>active? { 0 0 } >>window-loc f >>grab-input? V{ } clone >>window-resources @@ -177,7 +177,7 @@ M: world resize-world drop ; M: world dim<< [ call-next-method ] [ - dup active?>> 100 = [ + dup active?>> [ dup handle>> [ [ set-gl-context ] [ resize-world ] bi ] [ drop ] if @@ -197,7 +197,7 @@ M: world draw-world* : draw-world? ( world -- ? ) ! We don't draw deactivated worlds, or those with 0 size. ! On Windows, the latter case results in GL errors. - { [ active?>> 100 = ] [ handle>> ] [ dim>> [ 0 > ] all? ] } 1&& ; + { [ active?>> ] [ handle>> ] [ dim>> [ 0 > ] all? ] } 1&& ; TUPLE: world-error error world ; @@ -217,7 +217,7 @@ ui-error-hook [ [ rethrow ] ] initialize dup [ draw-world* ] with-gl-context flush-layout-cache-hook get call( -- ) ] [ - swap 0 >>active? ui-error + swap f >>active? ui-error ] recover ] with-variable ] [ drop ] if ;