Deallocate the GLX context and visual in the proper way
parent
0f18151f15
commit
87041b2038
|
@ -23,7 +23,7 @@
|
|||
|
||||
- collapsing an outliner is broken
|
||||
- x11:
|
||||
- dealloc glx context, call xfree, etc
|
||||
- title bars are funny
|
||||
- input methods
|
||||
- cocoa:
|
||||
- global menu bar with useful commands
|
||||
|
|
|
@ -16,3 +16,6 @@ USING: alien arrays errors kernel namespaces sequences ;
|
|||
: create-context ( XVisualInfo* -- GLXContext )
|
||||
>r dpy get r> f 1 glXCreateContext
|
||||
[ "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 -- )
|
||||
swap close-box? [
|
||||
dup world-handle first >r close-world r> destroy-window*
|
||||
dup world-handle
|
||||
>r close-world
|
||||
r> first2 destroy-window*
|
||||
] [
|
||||
drop
|
||||
] if ;
|
||||
|
|
|
@ -34,13 +34,14 @@ USING: alien hashtables kernel math namespaces sequences ;
|
|||
window-attributes XCreateWindow ;
|
||||
|
||||
: 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 -- )
|
||||
dpy get swap XDestroyWindow drop ;
|
||||
|
||||
: destroy-window* ( win -- )
|
||||
dup windows get remove-hash destroy-window ;
|
||||
: destroy-window* ( win context -- )
|
||||
destroy-context dup windows get remove-hash destroy-window ;
|
||||
|
||||
: set-closable ( win -- )
|
||||
dpy get swap "WM_DELETE_WINDOW" x-atom <Atom> 1
|
||||
|
|
|
@ -1317,5 +1317,9 @@ FUNCTION: Status XSetStandardProperties (
|
|||
: PropModePrepend 1 ; inline
|
||||
: PropModeAppend 2 ; inline
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! 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 ) ;
|
||||
|
|
Loading…
Reference in New Issue