Can anyone help me with this? I'm working with Xlib in SBCL and want
to quit the window back to the REPL. Obviously, I can do this through
the window manager with client-message by pressing the window close
button. But I want to do it from a menu Exit command, which calls a
function outside the message loop. If I call Xlib:close-display, I
get an error that I'm trying to use a closed display - which indicates
that the window messsaging loop is still running after the display
closes (??). If I add (sb-ext:quit), that shuts everything down, but
I'm no longer in the REPL. What I want to do is stop the loop, close
the display, and return to the REPL.
Any hints on how to do this?
WoodHacker wrote:
> Can anyone help me with this? I'm working with Xlib in SBCL and want
> to quit the window back to the REPL. Obviously, I can do this through
> the window manager with client-message by pressing the window close
> button. But I want to do it from a menu Exit command, which calls a
> function outside the message loop. If I call Xlib:close-display, I
> get an error that I'm trying to use a closed display - which indicates
> that the window messsaging loop is still running after the display
> closes (??). If I add (sb-ext:quit), that shuts everything down, but
> I'm no longer in the REPL. What I want to do is stop the loop, close
> the display, and return to the REPL.
>
> Any hints on how to do this?
>
Briefly reading the manual
http://common-lisp.net/project/cmucl/doc/clx/
Subsection 12
http://common-lisp.net/project/cmucl/doc/clx/12_Events_and_Input.html
Subsection 12.5
http://common-lisp.net/project/cmucl/doc/clx/12_5_Sending_Events.html
I assume you send a :destroy-notify using clx:send-event. This, I assume
will put an event on the client event queue and will close the display.
http://common-lisp.net/project/cmucl/doc/clx/12_12_5_Window_State_Events.html#:destroy-notify
Wade
"WoodHacker" <·······@comcast.net> writes:
> Can anyone help me with this? I'm working with Xlib in SBCL and want
> to quit the window back to the REPL. Obviously, I can do this through
> the window manager with client-message by pressing the window close
> button. But I want to do it from a menu Exit command, which calls a
> function outside the message loop. If I call Xlib:close-display, I
> get an error that I'm trying to use a closed display - which indicates
> that the window messsaging loop is still running after the display
> closes (??). If I add (sb-ext:quit), that shuts everything down, but
> I'm no longer in the REPL. What I want to do is stop the loop, close
> the display, and return to the REPL.
>
> Any hints on how to do this?
Defer the event!
;; Pseudo-code:
(defun dispatch (event)
...
(defer-event :close-window window)
...)
(loop
(dispatch (get-event))
(process-defered-events))
--
__Pascal Bourguignon__ http://www.informatimago.com/
You never feed me.
Perhaps I'll sleep on your face.
That will sure show you.