[mcclim-cvs] CVS mcclim/Backends/CLX

crhodes crhodes at common-lisp.net
Wed Feb 18 17:34:44 UTC 2009


Update of /project/mcclim/cvsroot/mcclim/Backends/CLX
In directory cl-net:/tmp/cvs-serv23740/Backends/CLX

Modified Files:
	port.lisp 
Log Message:
Fix for keyboard focus when the pointer is not in the application 
window.

I don't really understand why, but the what is simple: make sure that 
the top-level-sheet-pane has a mirror which does not mask away 
:key-press and :key-release events.

Include a comment above a restoration of the :wm_take_focus protocol 
implementation (which is currently not used) to explain some of this.


--- /project/mcclim/cvsroot/mcclim/Backends/CLX/port.lisp	2008/10/23 20:49:12	1.136
+++ /project/mcclim/cvsroot/mcclim/Backends/CLX/port.lisp	2009/02/18 17:34:44	1.137
@@ -452,7 +452,7 @@
                                       :map nil
                                       :width (round-coordinate (space-requirement-width q))
                                       :height (round-coordinate (space-requirement-height q))
-                                      :event-mask nil)))
+                                      :event-mask '(:key-press :key-release))))
       (setf (xlib:wm-hints window) (xlib:make-wm-hints :input :on))
       (setf (xlib:wm-name window) (frame-pretty-name frame))
       (setf (xlib:wm-icon-name window) (frame-pretty-name frame))
@@ -868,6 +868,21 @@
   (warn "Unprocessed client message: ~:_type = ~S;~:_ data = ~S;~_ sheet = ~S."
         type data sheet))
 
+;;; this client message is only necessary if we advertise that we
+;;; participate in the :WM_TAKE_FOCUS protocol; otherwise, the window
+;;; manager is responsible for all setting of input focus for us.  If
+;;; we want to do something more complicated with server input focus,
+;;; then this method should be adjusted appropriately and the
+;;; top-level-sheet REALIZE-MIRROR method should be adjusted to add
+;;; :WM_TAKE_FOCUS to XLIB:WM-PROTOCOLS.  CSR, 2009-02-18
+(defmethod port-wm-protocols-message (sheet time (message (eql :wm_take_focus)) data)
+  (let ((timestamp (elt data 1))
+        (mirror (sheet-mirror sheet)))
+    (when mirror
+      (xlib:set-input-focus (clx-port-display *clx-port*)
+                            mirror :parent timestamp))
+    nil))
+
 (defmethod port-wm-protocols-message (sheet time (message (eql :wm_delete_window)) data)
   (declare (ignore data))
   (make-instance 'window-manager-delete-event :sheet sheet :timestamp time))





More information about the Mcclim-cvs mailing list