cvs diff: Diffing . Index: core.lisp =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/core.lisp,v retrieving revision 1.136 diff -u -r1.136 core.lisp --- core.lisp 7 May 2007 00:04:20 -0000 1.136 +++ core.lisp 5 Jun 2007 15:36:31 -0000 @@ -2153,31 +2212,25 @@ (interactive-command cmd) (message "~{~a ~}not bound." (mapcar 'print-key (nreverse key-seq)))))))) -(defun bytes-to-window (bytes) - "A sick hack to assemble 4 bytes into a 32 bit number. This is -because ratpoison sends the rp_command_request window in 8 byte -chunks." - (+ (first bytes) - (ash (second bytes) 8) - (ash (third bytes) 16) - (ash (fourth bytes) 24))) - (defun handle-rp-commands (root) "Handle a ratpoison style command request." - (labels ((one-cmd () - (multiple-value-bind (win type format bytes-after) (xlib:get-property root :rp_command_request :end 4 :delete-p t) - (declare (ignore type format)) - (setf win (xlib::lookup-window *display* (bytes-to-window win))) - (when (xlib:window-p win) - (let* ((data (xlib:get-property win :rp_command)) - (interactive-p (car data)) - (cmd (map 'string 'code-char (nbutlast (cdr data))))) - (declare (ignore interactive-p)) - (interactive-command cmd) - (xlib:change-property win :rp_command_result (map 'list 'char-code "0TODO") :string 8) - (xlib:display-finish-output *display*))) - bytes-after))) - (loop while (> (one-cmd) 0)))) + (multiple-value-bind (windows type format) (xlib:get-property root :rp_command_request :delete-p t) + ;; Old ratpoisons used to send the window with format 8 (without + ;; endianness information). Discard such requests... + (when (and (eq type :window) + (eql format 32)) + (dolist (win windows) + (setf win (xlib::lookup-window *display* win)) + (when (xlib:window-p win) + (dformat 0 "found a window: ~A~%" win) + (let* ((data (xlib:get-property win :rp_command)) + (interactive-p (car data)) + (cmd (map 'string 'code-char (nbutlast (cdr data))))) + (declare (ignore interactive-p)) + (dformat 0 "found command ~s~%" cmd) + (interactive-command cmd) + (xlib:change-property win :rp_command_result (map 'list 'char-code "0TODO") :string 8) + (xlib:display-finish-output *display*))))))) (defun update-window-properties (window atom) (case atom