ui: change active? back to a boolean.
parent
8e59246a8b
commit
1b71efb748
|
@ -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> window-handle
|
||||
|
||||
|
@ -144,7 +143,7 @@ M:: cocoa-ui-backend (open-window) ( world -- )
|
|||
window install-window-delegate
|
||||
view window <window-handle> 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* <CGSize> -> setContentSize: ;
|
||||
M: cocoa-ui-backend resize-window
|
||||
[ handle>> window>> ] [ first2 ] bi* <CGSize> -> setContentSize: ;
|
||||
|
||||
M: cocoa-ui-backend system-alert
|
||||
NSAlert -> alloc -> init -> autorelease [
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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? <world-error> ui-error
|
||||
swap f >>active? <world-error> ui-error
|
||||
] recover
|
||||
] with-variable
|
||||
] [ drop ] if ;
|
||||
|
|
Loading…
Reference in New Issue