Deallocate the GLX context and visual in the proper way
parent
0f18151f15
commit
87041b2038
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
- collapsing an outliner is broken
|
- collapsing an outliner is broken
|
||||||
- x11:
|
- x11:
|
||||||
- dealloc glx context, call xfree, etc
|
- title bars are funny
|
||||||
- input methods
|
- input methods
|
||||||
- cocoa:
|
- cocoa:
|
||||||
- global menu bar with useful commands
|
- global menu bar with useful commands
|
||||||
|
|
|
@ -16,3 +16,6 @@ USING: alien arrays errors kernel namespaces sequences ;
|
||||||
: create-context ( XVisualInfo* -- GLXContext )
|
: create-context ( XVisualInfo* -- GLXContext )
|
||||||
>r dpy get r> f 1 glXCreateContext
|
>r dpy get r> f 1 glXCreateContext
|
||||||
[ "Failed to create GLX context" throw ] unless* ;
|
[ "Failed to create GLX context" throw ] unless* ;
|
||||||
|
|
||||||
|
: destroy-context ( GLXContext -- )
|
||||||
|
dpy get swap glXDestroyContext ;
|
||||||
|
|
|
@ -92,7 +92,9 @@ M: world key-up-event ( event world -- ) 2drop ;
|
||||||
|
|
||||||
M: world client-event ( event world -- )
|
M: world client-event ( event world -- )
|
||||||
swap close-box? [
|
swap close-box? [
|
||||||
dup world-handle first >r close-world r> destroy-window*
|
dup world-handle
|
||||||
|
>r close-world
|
||||||
|
r> first2 destroy-window*
|
||||||
] [
|
] [
|
||||||
drop
|
drop
|
||||||
] if ;
|
] if ;
|
||||||
|
|
|
@ -34,14 +34,15 @@ USING: alien hashtables kernel math namespaces sequences ;
|
||||||
window-attributes XCreateWindow ;
|
window-attributes XCreateWindow ;
|
||||||
|
|
||||||
: glx-window ( dim -- window context )
|
: glx-window ( dim -- window context )
|
||||||
first2 choose-visual [ create-window ] keep create-context ;
|
first2 choose-visual
|
||||||
|
[ [ create-window ] keep create-context ] keep XFree ;
|
||||||
|
|
||||||
: destroy-window ( win -- )
|
: destroy-window ( win -- )
|
||||||
dpy get swap XDestroyWindow drop ;
|
dpy get swap XDestroyWindow drop ;
|
||||||
|
|
||||||
: destroy-window* ( win -- )
|
: destroy-window* ( win context -- )
|
||||||
dup windows get remove-hash destroy-window ;
|
destroy-context dup windows get remove-hash destroy-window ;
|
||||||
|
|
||||||
: set-closable ( win -- )
|
: set-closable ( win -- )
|
||||||
dpy get swap "WM_DELETE_WINDOW" x-atom <Atom> 1
|
dpy get swap "WM_DELETE_WINDOW" x-atom <Atom> 1
|
||||||
XSetWMProtocols drop ;
|
XSetWMProtocols drop ;
|
||||||
|
|
|
@ -1317,5 +1317,9 @@ FUNCTION: Status XSetStandardProperties (
|
||||||
: PropModePrepend 1 ; inline
|
: PropModePrepend 1 ; inline
|
||||||
: PropModeAppend 2 ; inline
|
: PropModeAppend 2 ; inline
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
! The rest of the stuff is not from the book.
|
! The rest of the stuff is not from the book.
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
FUNCTION: void XFree ( void* data ) ;
|
||||||
FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
|
FUNCTION: int XStoreName ( Display* display, Window w, char* window_name ) ;
|
||||||
|
|
Loading…
Reference in New Issue