I am trying to read the client message sent from the window manager on
a delete window request. I've added a wm_delete_window property which
causes the X to show up on the window manager's title bar and I'm
getting the client message sent to me when I click on the X. I check
the type and get :wm_protocols as I should. But when I check data it
is always nil. The first sequence in data should be the
wm_delete_window atom. Am I reading data wrong? SBCL doesn't seem
to connect data to client-message (it labels it with my package). Can
anyone explain how to check for the proper atom so I can close the
display?
Here's how Garnet does it. If you have access to the garnet src, this
is in src/opal/x.lisp.
The event handling looks like this:
(defun x-event-handler (root-window ignore-keys)
(let ((display (the-display root-window)))
(xlib:event-case
(display :discard-p t :timeout (if ignore-keys 0 NIL))
;; this first one is for when a window is deleted by the wm
(:CLIENT-MESSAGE
(event-window type data format)
(event-handler-debug :CLIENT-MESSAGE event-window type data format)
(do-client-message event-window type data format display))
<rest of event handling stuff omitted>
The client message handler looks like this:
(defun do-client-message (event-window type data format display)
(cond ((and (eq format 32)
(eq type :WM_PROTOCOLS)
(eq (xlib:atom-name display (aref (the (simple-array
(unsigned-byte 32) (5))
data) 0))
:WM_DELETE_WINDOW))
(Delete-Notify NIL event-window))
((and (eq format 32)
(eq type :TIMER_EVENT))
(if interactors::*trans-from-file*
T
;; ignore events when read transcript
(interactors::Queue-Timer-Event (aref (the (simple-array
(unsigned-byte 32) (5))
data) 0)))))
NIL)
Hope this helps.
--
Fred Gilham ······@csl.sri.com
...the War between the States established...this principle, that the
federal government is, through its courts, the final judge of its own
powers. -- Woodrow Wilson, explaining who will watch the watchers.