Index: Backends/beagle/package.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Backends/beagle/package.lisp,v
retrieving revision 1.5
diff -u -8 -p -r1.5 package.lisp
--- Backends/beagle/package.lisp	30 Mar 2006 12:07:59 -0000	1.5
+++ Backends/beagle/package.lisp	11 Dec 2007 22:56:02 -0000
@@ -1,11 +1,13 @@
-
 ;;; -*- Mode: Lisp; Package: COMMON-LISP-USER -*-
 
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (require :cocoa))
+
 ;;; START - Cribbed from framework/cocoa-support.lisp
 (in-package "CCL")
 (defun nslog (c)
   "Writes a string message to the OSX console log."
   (let* ((rep (format nil "~a" c)))
     (with-cstrs ((str rep))
       (with-nsstr (nsstr str (length rep))
 	(#_NSLog #@"Logging: %@" :address nsstr)))))
@@ -19,17 +21,16 @@
                 #:+alt-key+
                 ;;
                 #:port-text-style-mappings
                 #:port-lookup-mirror
                 #:port-register-mirror
 
                 #:port-event-process
                 #:port-grafts
-                #:%set-port-keyboard-focus
                 #:set-sheet-pointer-cursor
                 ;;
                 #:update-mirror-geometry
                 #:%sheet-mirror-region
                 #:%sheet-mirror-transformation
                 ;;
                 #:clamp
                 #:get-environment-variable
@@ -58,17 +59,16 @@
                 ;; fbound
                 #:medium-device-region
                 #:draw-image
                 #:text-style-character-width
                 #:height                ;this seems bogus
                 #:width                 ;dito
                 #:coordinate=
                 #:get-transformation
-                #:keyboard-input-focus
                 #:port-grab-pointer
                 #:port-ungrab-pointer
                 ;;
                 #:invoke-with-special-choices
                 #:medium-miter-limit
                 ;; classes:
                 #:mirrored-pixmap
                 #:window-destroy-event
@@ -95,9 +95,8 @@
 				#:rlet
 				#:send
 				#:send-super
 				#:slet
 				#:with-cstrs
 				#:with-nsstr)
   (:export #:beagle-standard-frame-manager
 	   #:beagle-aqua-frame-manager))
-		
\ No newline at end of file
Index: Backends/beagle/input/events.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Backends/beagle/input/events.lisp,v
retrieving revision 1.11
diff -u -8 -p -r1.11 events.lisp
--- Backends/beagle/input/events.lisp	24 Mar 2006 11:18:27 -0000	1.11
+++ Backends/beagle/input/events.lisp	11 Dec 2007 22:56:02 -0000
@@ -157,19 +157,18 @@ signals the port event semaphore when a 
 ;;; timeout = timeout delay in seconds
 ;;; If no timeout is specified (nil timeout), this method hangs around until an
 ;;; event arrives.
 ;;;
 ;;; get-next-event is not defined because it is not used in the Beagle backend
 ;;; (there is no event process calling process-next-event).
 #-(and)
 (defmethod get-next-event ((port beagle-port) &key wait-function (timeout nil))
-  (declare (special *mcclim-event-queue* *beagle-port*)
+  (declare (special *mcclim-event-queue*)
 	   (ignore wait-function))
-  (setf *beagle-port* port)  ; TODO: don't think this <- is needed.
   ;; When event queue is empty, wait for an event to be posted.
   (if (eq timeout nil)
       (ccl:wait-on-semaphore (beagle-port-event-semaphore port))
     (ccl:timed-wait-on-semaphore (beagle-port-event-semaphore port) timeout))
   ;; Event queue semaphore has been raised (in which case the queue
   ;; should be non-null), or the semaphore timed out.
   (let ((event (and *mcclim-event-queue* (pop *mcclim-event-queue*))))
     (if (not event)
@@ -566,19 +565,21 @@ not a mouse event)."
     (cond ((eq :became-key n-type)
 	   (when (send window 'is-visible) ; only do if window is on-screen...
 	     (let* ((content-view (send window 'content-view))
 		    (target-sheet (%beagle-port-lookup-sheet-for-view
 				   *beagle-port* content-view))
 		    (frame (pane-frame target-sheet))
 		    ;; Works out which sheet *should* be the focus, not which
 		    ;; is currently... or at least, so I think.
-		    (focus (climi::keyboard-input-focus frame)))
+		    (focus (port-frame-keyboard-input-focus *beagle-port*
+                                                            frame)))
 	       (unless (null target-sheet)
-		 (setf (port-keyboard-input-focus *beagle-port*) focus))))
+		 (setf (port-frame-keyboard-input-focus *beagle-port* frame)
+                       focus))))
 	   nil)
 	  ((eq :did-expose n-type)
 	   (make-instance 'window-repaint-event
 			  :timestamp (get-internal-real-time)
 			  :sheet     sheet
 			  ;; Region is the whole window on expose... doesn't
 			  ;; seem to be a way to specify a region... coord
 			  ;; system?
Index: Backends/beagle/windowing/port.lisp
===================================================================
RCS file: /project/mcclim/cvsroot/mcclim/Backends/beagle/windowing/port.lisp,v
retrieving revision 1.6
diff -u -8 -p -r1.6 port.lisp
--- Backends/beagle/windowing/port.lisp	24 Mar 2006 11:18:27 -0000	1.6
+++ Backends/beagle/windowing/port.lisp	11 Dec 2007 22:56:02 -0000
@@ -229,8 +229,16 @@ not initialised, we'll just get \":scree
 ;;; press the "help" key in which case Cocoa gives us a '?' pointer. Varied pointers are not
 ;;; yet supported in this back end.
 
 ;;; Needs implementing ::FIXME::
 (defun make-cursor-table (port)
   (declare (ignore port))
   nil)
 
+(defmethod port-frame-keyboard-input-focus ((port beagle-port) frame)
+  (declare (ignore frame))
+  (beagle-port-key-focus port))
+
+(defmethod (setf port-frame-keyboard-input-focus)
+    (focus (port beagle-port) frame)
+  (declare (ignore frame))
+  (%set-port-keyboard-focus port focus))
