[mcclim-cvs] CVS mcclim/Backends/gtkairo

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


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

Modified Files:
	ffi.lisp port.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/Backends/gtkairo/ffi.lisp	2007/02/04 12:55:44	1.16
+++ /project/mcclim/cvsroot/mcclim/Backends/gtkairo/ffi.lisp	2007/02/07 12:44:19	1.17
@@ -1625,6 +1625,10 @@
   (requisition :pointer)                ;GtkRequisition *
   )
 
+(defcfun "gtk_window_get_focus"
+    :pointer
+  (window :pointer))
+
 (defcfun "gtk_window_move"
     :void
   (window :pointer)                     ;GtkWindow *
--- /project/mcclim/cvsroot/mcclim/Backends/gtkairo/port.lisp	2007/02/04 12:55:44	1.16
+++ /project/mcclim/cvsroot/mcclim/Backends/gtkairo/port.lisp	2007/02/07 12:44:19	1.17
@@ -742,10 +742,22 @@
 		  ;; reasonable timestamp.
 		  :timestamp 0)))))))))
 
-(defmethod %set-port-keyboard-focus ((port gtkairo-port) focus &key timestamp)
-  (declare (ignore timestamp))
+(defmethod port-frame-keyboard-input-focus ((port gtkairo-port) frame)
   (with-gtk ()
-    (gtk_widget_grab_focus (mirror-widget (sheet-mirror focus)))))
+    (let* ((sheet (frame-top-level-sheet frame))
+           (mirror (climi::port-lookup-mirror port sheet))
+           (widget (gtk_window_get_focus (mirror-window mirror))))
+      (if (cffi:null-pointer-p widget)
+          nil
+          (widget->sheet widget port)))))
+
+(defmethod (setf port-frame-keyboard-input-focus) 
+    (focus (port gtkairo-port) frame)
+  (with-gtk ()
+    ;; could use gtk_window_set_focus here for symmetry, but we don't
+    ;; have to.
+    (gtk_widget_grab_focus (mirror-widget (sheet-mirror focus))))
+  focus)
 
 (defmethod port-force-output ((port gtkairo-port))
   (with-gtk ()




More information about the Mcclim-cvs mailing list