Better top-level window positioning on Cocoa and X11
parent
97c59a3cf8
commit
c3a6e02a38
|
@ -1,5 +1,6 @@
|
||||||
+ 0.87:
|
+ 0.87:
|
||||||
|
|
||||||
|
- live search operations need to hide the minibuffer
|
||||||
- vocab links don't work
|
- vocab links don't work
|
||||||
- browse modules and vocabs by showing a new list
|
- browse modules and vocabs by showing a new list
|
||||||
- get rid of the navigator in the browser tool
|
- get rid of the navigator in the browser tool
|
||||||
|
|
|
@ -79,9 +79,17 @@ IN: gadgets
|
||||||
: set-title ( string world -- )
|
: set-title ( string world -- )
|
||||||
world-handle second swap <NSString> -> setTitle: ;
|
world-handle second swap <NSString> -> setTitle: ;
|
||||||
|
|
||||||
|
: auto-position ( world -- )
|
||||||
|
dup world-loc { 0 0 } = [
|
||||||
|
world-handle second -> center
|
||||||
|
] [
|
||||||
|
drop
|
||||||
|
] if ;
|
||||||
|
|
||||||
: open-window* ( world -- )
|
: open-window* ( world -- )
|
||||||
dup gadget-window
|
dup gadget-window
|
||||||
dup start-world
|
dup start-world
|
||||||
|
dup auto-position
|
||||||
world-handle second f -> makeKeyAndOrderFront: ;
|
world-handle second f -> makeKeyAndOrderFront: ;
|
||||||
|
|
||||||
: raise-window ( world -- )
|
: raise-window ( world -- )
|
||||||
|
|
|
@ -36,12 +36,16 @@ USING: alien gadgets hashtables kernel math namespaces sequences ;
|
||||||
USPosition over set-XSizeHints-flags
|
USPosition over set-XSizeHints-flags
|
||||||
dpy get -rot XSetWMNormalHints ;
|
dpy get -rot XSetWMNormalHints ;
|
||||||
|
|
||||||
|
: auto-position ( window loc -- )
|
||||||
|
{ 0 0 } = [ drop ] [ set-size-hints ] if ;
|
||||||
|
|
||||||
: create-window ( loc dim visinfo -- window )
|
: create-window ( loc dim visinfo -- window )
|
||||||
|
pick >r
|
||||||
>r >r >r dpy get root get r> first2 r> first2 0 r>
|
>r >r >r dpy get root get r> first2 r> first2 0 r>
|
||||||
[ XVisualInfo-depth InputOutput ] keep
|
[ XVisualInfo-depth InputOutput ] keep
|
||||||
[ XVisualInfo-visual create-window-mask ] keep
|
[ XVisualInfo-visual create-window-mask ] keep
|
||||||
window-attributes XCreateWindow
|
window-attributes XCreateWindow
|
||||||
dup set-size-hints ;
|
dup r> auto-position ;
|
||||||
|
|
||||||
: glx-window ( loc dim -- window context )
|
: glx-window ( loc dim -- window context )
|
||||||
choose-visual
|
choose-visual
|
||||||
|
|
Loading…
Reference in New Issue