[mcclim-cvs] CVS mcclim/Drei

crhodes crhodes at common-lisp.net
Wed Feb 7 12:44:21 UTC 2007


Update of /project/mcclim/cvsroot/mcclim/Drei
In directory clnet:/tmp/cvs-serv16608/Drei

Modified Files:
	drei-clim.lisp 
Log Message:
New click-to-focus policy for text-editor gadgets and panes, implemented
for the CLX, Null and gtkairo backends (but gtk_window_get_focus() 
hand-inserted into gtkairo/ffi.lisp).

PORT-KEYBOARD-INPUT-FOCUS is now a trampoline to 
PORT-FRAME-KEYBOARD-INPUT-FOCUS, a per-port function to set the keyboard 
focus for a particular frame.  Not implemented for Beagle or OpenGL 
backends.

Now Drei / Goatee gadgets don't have to do their own keyboard 
focus handling on arm/disarm any more.  Various kludges sprinkled all 
over the place to make this so.


--- /project/mcclim/cvsroot/mcclim/Drei/drei-clim.lisp	2007/01/17 11:43:51	1.16
+++ /project/mcclim/cvsroot/mcclim/Drei/drei-clim.lisp	2007/02/07 12:44:20	1.17
@@ -206,8 +206,6 @@
 ;;; updating is done after a command has been executed, and only then
 ;;; (or by commands at their own discretion).
 (defclass drei-gadget-pane (drei-pane value-gadget action-gadget
-                                      #+(or mcclim building-mcclim) ; No idea how it works in classic CLIM.
-                                      climi::enter/exit-arms/disarms-mixin
                                       asynchronous-command-processor)
   ((%currently-processing :initform nil
                           :accessor currently-processing-p)
@@ -251,21 +249,13 @@
                             (gadget-id gadget)
                             new-value)))
 
-;; It's really silly that we have to manage keyboard input focus
-;; ourself.
 (defmethod armed-callback :after ((gadget drei-gadget-pane) client id)
   (declare (ignore client id))
-  (let ((port (port gadget)))
-    (setf (previous-focus gadget) (port-keyboard-input-focus port))
-    (setf (port-keyboard-input-focus port) gadget))
   (setf (active gadget) t)
   (display-drei gadget))
 
 (defmethod disarmed-callback :after ((gadget drei-gadget-pane) client id)
   (declare (ignore client id))
-  (let ((port (port gadget)))
-    (setf (port-keyboard-input-focus port) (previous-focus gadget))
-    (setf (previous-focus gadget) nil))
   (setf (active gadget) nil)
   (display-drei gadget))
 
@@ -320,6 +310,13 @@
             (let ((*standard-input* (or *minibuffer* *standard-input*)))
               (handle-gesture gadget gesture))))))))
 
+(defmethod handle-event :before 
+    ((gadget drei-gadget-pane) (event pointer-button-press-event))
+  (let ((previous (stream-set-input-focus gadget)))
+    (when (and previous (typep previous 'gadget))
+      (disarmed-callback previous (gadget-client previous) (gadget-id previous)))
+    (armed-callback gadget (gadget-client gadget) (gadget-id gadget))))
+
 (defmethod invoke-accepting-from-user ((drei drei-gadget-pane) (continuation function))
   ;; When an `accept' is called during the execution of a command for
   ;; the Drei gadget, we must deactivate the gadget in order to not




More information about the Mcclim-cvs mailing list