[Openmcl-cvs-notifications] r14904 - in /trunk/source/cocoa-ide: app-delegate.lisp cocoa-listener.lisp hemlock/src/listener.lisp

gb at clozure.com gb at clozure.com
Mon Jul 25 12:40:39 CDT 2011


Author: gb
Date: Mon Jul 25 12:40:38 2011
New Revision: 14904

Log:
Try to fix ticket:845 a different way.
ACTIVE-LISTENER-WINDOWS returns an ordered list of all listener
windows that are visible and have processes associated with them.
#/showListener uses ACTIVE-LISTENER-WINDOWS to find/activate an
active listener window.
#/windowShouldClose: on listener windows returns T unless there's
a background process associated with the window, in which case it
hides the window and returns NIL.  (This is similar to the pre-14811
behavior, but gets the test right.)
Define #/topListener in terms of ACTIVE-LISTENER-WINDOWS.
Define the function GUI::TOP-LISTENER-DOCUMENT as a wrapper around
#/topListener and call it (rather than the ObjC method) from Hemlock.

Modified:
    trunk/source/cocoa-ide/app-delegate.lisp
    trunk/source/cocoa-ide/cocoa-listener.lisp
    trunk/source/cocoa-ide/hemlock/src/listener.lisp

Modified: trunk/source/cocoa-ide/app-delegate.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/app-delegate.lisp (original)
+++ trunk/source/cocoa-ide/app-delegate.lisp Mon Jul 25 12:40:38 2011
@@ -134,19 +134,26 @@
   (#/openUntitledDocumentOfType:display:
    (#/sharedDocumentController ns:ns-document-controller) #@"Listener" t))
 =

+(defun active-listener-windows ()
+  (let* ((listener-windows ())
+         (all-windows (#/orderedWindows *NSApp*)))
+    (dotimes (i (#/count all-windows) (nreverse listener-windows))
+      (let* ((w (#/objectAtIndex: all-windows i))
+             (wc (#/windowController w)))
+        (when (and (typep wc 'hemlock-listener-window-controller)
+                   (#/isVisible w))
+          (let* ((doc (#/document wc)))
+            (unless (%null-ptr-p doc)
+              (when (hemlock-document-process doc)
+                (push w listener-windows)))))))))
+        =

+                =

 (objc:defmethod (#/showListener: :void) ((self lisp-application-delegate)
                                         sender)
   (declare (ignore sender))
-  (let* ((all-windows (#/orderedWindows *NSApp*))
-	 (key-window (#/keyWindow *NSApp*))
-	 (listener-windows ())
+  (let* ((key-window (#/keyWindow *NSApp*))
+	 (listener-windows (active-listener-windows))
 	 (top-listener nil))
-    (dotimes (i (#/count all-windows))
-      (let* ((w (#/objectAtIndex: all-windows i))
-	     (wc (#/windowController w)))
-	(when (eql (#/class wc) hemlock-listener-window-controller)
-	  (push w listener-windows))))
-    (setq listener-windows (nreverse listener-windows))
     (setq top-listener (car listener-windows))
     (cond =

      ((null listener-windows)

Modified: trunk/source/cocoa-ide/cocoa-listener.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/cocoa-listener.lisp (original)
+++ trunk/source/cocoa-ide/cocoa-listener.lisp Mon Jul 25 12:40:38 2011
@@ -305,14 +305,15 @@
 =

 (objc:defmethod (#/windowShouldClose: #>BOOL) ((w hemlock-listener-frame)
                                                sender)
+  (declare (ignorable sender))
   (let* ((doc (#/document (#/windowController w))))
     (if (or (%null-ptr-p doc)
-            (and (hemlock-document-process doc)
-                 (perform-close-kills-process-p doc)))
+            (null (hemlock-document-process doc)) =

+            (perform-close-kills-process-p doc))
       t
       (progn
-        ;(#/orderOut: w sender)
-        (#/close w)
+        (#/orderOut: w sender)
+        ;(#/close w)
         nil))))
 =

 =

@@ -383,15 +384,15 @@
               (ccl:process-whostate proc)))))
 =

 (objc:defmethod #/topListener ((self +hemlock-listener-document))
-  (let* ((all-windows (#/orderedWindows *NSApp*)))
-    (dotimes (i (#/count all-windows) +null-ptr+)
-      (let* ((w (#/objectAtIndex: all-windows i)))
-        (when (#/isVisible w)
-          (let* ((wc (#/windowController w))
-                 (doc (#/document wc)))
-            (unless (%null-ptr-p doc)
-              (when (#/isKindOfClass: doc self)
-                (return doc)))))))))
+  (let* ((w (car (active-listener-windows))))
+    (if w
+      (#/document (#/windowController w))
+      +null-ptr+)))
+
+(defun top-listener-document ()
+  (let* ((doc (#/topListener hemlock-listener-document)))
+    (unless (%null-ptr-p doc) doc)))
+
 =

 (defun symbol-value-in-top-listener-process (symbol)
   (let* ((process (hemlock-document-process (#/topListener hemlock-listene=
r-document))))

Modified: trunk/source/cocoa-ide/hemlock/src/listener.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/hemlock/src/listener.lisp (original)
+++ trunk/source/cocoa-ide/hemlock/src/listener.lisp Mon Jul 25 12:40:38 20=
11
@@ -607,7 +607,8 @@
                     (current-region)
                     (defun-region (current-point)))))
          (form (when *echo-expression-to-listener* (region-to-string regio=
n)))
-         (buf (gui::hemlock-buffer (#/topListener gui::hemlock-listener-do=
cument))))
+         (doc (gui::top-listener-document))
+         (buf (when doc (gui::hemlock-buffer doc))))
     (when buf
       (let ((HI::*CURRENT-BUFFER* buf))
         (move-mark (current-point) (region-end (buffer-region buf)))))
@@ -619,7 +620,8 @@
   (declare (ignore p))
   (let* ((region (copy-region (current-form-region)))
          (form (when *echo-expression-to-listener* (region-to-string regio=
n)))
-         (buf (gui::hemlock-buffer (#/topListener gui::hemlock-listener-do=
cument))))
+         (doc (gui::top-listener-document))
+         (buf (when doc (gui::hemlock-buffer doc))))
     (when buf
       (let ((HI::*CURRENT-BUFFER* buf))
         (move-mark (current-point) (region-end (buffer-region buf)))))



More information about the Openmcl-cvs-notifications mailing list