Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

applicationShouldHandleReopen now returns YES so that window de-minim…

…ization occurs

System handles de-minimization, or sends us event to create a new empty buffer.
  • Loading branch information...
commit 908bcf78c3258ce99670106262969d0e199f63d6 1 parent f04b18c
David Reitter authored
2  aquamacs/doc/latex/changelog.tex
View
@@ -9,6 +9,8 @@ \subsection{Changes--- 2.x}
\begin{itemize}
\item Isearch no longer aborts a search at seemingly random (but rare) times. Reported by Bill Sacks.
+\item Clicking on the Aquamacs dock icon will again create a new buffer or de-minimize a window, as is standard on OS X.
+Reported by Guy Gascoigne-Piggford.
\end{itemize}
\subsection{Changes--- 2.5}
62 aquamacs/src/site-lisp/one-buffer-one-frame.el
View
@@ -968,72 +968,12 @@ The buffer contains unsaved changes which will be lost if you discard them now."
;; is interpreted with wrong current buffer)
(set-buffer (window-buffer (selected-window))))
-;; (defun handle-ns-application-reopen ()
-;; (interactive)
-;; (if (visible-frame-list)
-;; ;; did it just bring up the *empty* frame?
-;; (let (last-iconified-frame)
-;; (and (= 1 (length (visible-frame-list)))
-;; (equal (buffer-name) " *empty*")
-;; (progn (mapcar (lambda (f) (if (and (not last-iconified-frame)
-;; (frame-live-p f) (frame-iconified-p f))
-;; (setq last-iconified-frame f))) (frame-list))
-;; last-iconified-frame)
-;; (let ((f (selected-frame)))
-
-;; (raise-frame last-iconified-frame)
-;; (make-frame-invisible f)
-;; )))
-;; (let ((list (frame-list)))
-;; (while list
-;; (when (frame-iconified-p (car list))
-;; (make-frame-visible (car list))
-;; (select-frame-set-input-focus (car list))
-;; (setq list))
-;; (setq list (cdr list))))))
(define-key special-event-map [ns-application-reopen] 'ignore)
-;; (define-key special-event-map [ns-application-activated] 'aquamacs-handle-app-activated)
(define-key global-map [ns-new-frame] 'new-empty-buffer-other-frame)
)
;; app-activated is no longer sent due to event loop problems.
-;; (defun aquamacs-handle-app-activated ()
-;; "Aquamacs has been activated.
-;; Ensure that there is a (hidden) frame in the current space."
-;; (interactive)
-;; (raise-frame))
-
-;; OSX 10.7....
-;; (run-with-idle-timer 0.5 nil 'aquamacs-handle-app-activated2))
- ;; Must call at idle time. Frame is not correctly
- ;; keyed if it is created at this time. (E.g., no blinking cursor,
- ;; and menu events are ignored.)
- ;; this is a problem with event handling at the C level
- ;; To Do: diagnose and fix. Perhaps related to the way
- ;; the NS port handles file requests via ns_pending_files
- ;; (which do not display the behavior.)
- ;; It appears that isOnActiveSpace returns the wrong
- ;; result shortly after switching. We increase the delay for this
- ;; reason. The invisible frame is only created in certain cases
- ;; anyways.
-
-;; (defun aquamacs-handle-app-activated2 ()
-;; (unless (or (ns-frame-is-on-active-space-p (selected-frame))
-;; ;; we're assuming that the selected frame, if full-frame,
-;; ;; will be on the active space. we're probably switching
-;; ;; to a space with a visible frame anyway, in this case.
-;; ;; https://github.com/davidswelt/aquamacs-emacs/issues/60
-;; (eq (frame-parameter nil 'fullscreen) 'fullboth))
-;; ;; find a frame on active space
-;; ;; (unless (ns-visible-frame-list)
-;; (let* ((display-buffer-reuse-frames 'select)
-;; (one-buffer-one-frame nil)
-;; (hf (aquamacs-make-empty-frame aquamacs-deleted-frame-position)))
-;; (when hf
-;; (select-window (frame-first-window hf))
-;; (make-frame-visible hf) ; HACK: must do this first, presumably to convince NS to make it key.
-;; ;; (switch-to-buffer (init-aquamacs-last-frame-empty-buffer) 'norecord)
-;; (make-frame-invisible hf t)))))
+;; it is also not necessary. At least in 10.8/Emacs 24, these events are handled correctly.
;; FIXES IN VARIOUS PLACES
19 src/nsterm.m
View
@@ -4695,17 +4695,24 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
- /* Unfortunately, hidden windows will be made key (and visible).
+
+ return YES;
+
+ /*
We cannot send Lisp an event from here - possibly because events would be processed in the wrong order.
switching between frames on different spaces by clicking on the app icon will leave the event
queue in an inconsistent state (requires key press before timer/menu events will be processed again).
+
+ By returning YES, Cocoa/Finder send us the appropriate events to de-minimize a frame
+ or create a new empty buffer.
*/
- return NO;
- // struct frame *emacsframe = SELECTED_FRAME ();
- // emacs_event->kind = NS_NONKEY_EVENT;
- // emacs_event->code = KEY_NS_APPLICATION_REOPEN;
- // EV_TRAILER ((id)nil);
+ /*
+ struct frame *emacsframe = SELECTED_FRAME ();
+ emacs_event->kind = NS_NONKEY_EVENT;
+ emacs_event->code = KEY_NS_APPLICATION_REOPEN;
+ EV_TRAILER ((id)nil);
+ */
}
/* post 10.7 Application restore feature */
Please sign in to comment.
Something went wrong with that request. Please try again.