From: Sam S. <sd...@gn...> - 2008-11-09 04:26:22
|
> * Philippe Brochard <ub...@se...> [2008-11-08 14:22:24 +0100]: > > Here is a test case for send-event which works with a window manager > and checks if the sended event is well handled. does not work for me: [2]> (xlib:with-open-display (dpy) (let* ((screen (first (xlib:display-roots dpy))) (root (xlib:screen-root screen)) (window (xlib:create-window :parent root :x 0 :y 0 :width 200 :height 200 :border-width 1 :event-mask '(:button-press))) (events (xlib:events-queued dpy))) (loop :repeat events :do (xlib:discard-current-event dpy)) (format t "~&Discarded ~:D event~:P~&" events) (xlib:send-event window :button-press 0 :x -9999) (format t "~&Sent event, queue is now: ~:D~%" (xlib:events-queued dpy)) ;; expect that the sent event is in the top ten events in the queue. (loop :repeat 10 :do (xlib:process-event dpy :handler (lambda (&rest data &key event-key x &allow-other-keys) (print data) ; show :pretty t (when (and (eql event-key :button-press) (= x -9999)) (return t))) :timeout 0.1)))) Discarded 0 events Sent event, queue is now: 0 (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) (:DISPLAY #<XLIB:DISPLAY localhost:0 (The X.Org Foundation R10502000) X11.0 #x000334C9DF80> :EVENT-CODE 4 :SEND-EVENT-P T :SEQUENCE 8 :EVENT-KEY :BUTTON-PRESS :CODE 0 :WINDOW NIL :EVENT-WINDOW NIL :CHILD NIL :ROOT NIL :X 0 :Y 0 :ROOT-X 0 :ROOT-Y 0 :STATE 0 :TIME 0 :SAME-SCREEN-P NIL) NIL [3]> -- Sam Steingold (http://sds.podval.org/) on Ubuntu 8.04 (hardy) http://palestinefacts.org http://mideasttruth.com http://jihadwatch.org http://honestreporting.com http://openvotingconsortium.org http://dhimmi.com If you want to shoot yourself, it is YOUR responsibility to wear armor. |