ui.backend.gtk: add auto-position for worlds with { 0 0 } in window-loc
parent
66f5c2695f
commit
59857ad2c1
|
@ -366,11 +366,21 @@ CONSTANT: window-controls>func-flags
|
||||||
f t GDK_GL_RGBA_TYPE enum>number gtk_widget_set_gl_capability
|
f t GDK_GL_RGBA_TYPE enum>number gtk_widget_set_gl_capability
|
||||||
] with-world-pixel-format ;
|
] with-world-pixel-format ;
|
||||||
|
|
||||||
|
: auto-position ( window loc -- )
|
||||||
|
dup { 0 0 } = [
|
||||||
|
drop dup window topmost-window =
|
||||||
|
GTK_WIN_POS_CENTER GTK_WIN_POS_NONE ?
|
||||||
|
gtk_window_set_position
|
||||||
|
] [ first2 gtk_window_move ] if ;
|
||||||
|
|
||||||
M:: gtk-ui-backend (open-window) ( world -- )
|
M:: gtk-ui-backend (open-window) ( world -- )
|
||||||
GTK_WINDOW_TOPLEVEL gtk_window_new :> win
|
GTK_WINDOW_TOPLEVEL gtk_window_new :> win
|
||||||
win <window-handle> world handle<<
|
|
||||||
world [ window-loc>> win swap first2 gtk_window_move ]
|
world win [ <window-handle> >>handle drop ]
|
||||||
[ dim>> win swap first2 gtk_window_set_default_size ] bi
|
[ register-window ] 2bi
|
||||||
|
|
||||||
|
win world [ window-loc>> auto-position ]
|
||||||
|
[ dim>> first2 gtk_window_set_default_size ] 2bi
|
||||||
|
|
||||||
world setup-gl drop
|
world setup-gl drop
|
||||||
|
|
||||||
|
@ -379,8 +389,6 @@ M:: gtk-ui-backend (open-window) ( world -- )
|
||||||
win gtk_widget_realize
|
win gtk_widget_realize
|
||||||
win world window-controls>> configure-window-controls
|
win world window-controls>> configure-window-controls
|
||||||
|
|
||||||
world win register-window
|
|
||||||
|
|
||||||
win gtk_widget_show_all ;
|
win gtk_widget_show_all ;
|
||||||
|
|
||||||
M: gtk-ui-backend (close-window) ( handle -- )
|
M: gtk-ui-backend (close-window) ( handle -- )
|
||||||
|
|
Loading…
Reference in New Issue