changeset 83620:ce4352d8bee9

* loadup.el: Load mac-win on a Mac. Avoid loading both x-win and mac-win. * term/mac-win.el: (mac-initialize-window-system): New function. Move global setup here. * s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here. (SYSTEM_PURESIZE_EXTRA): Only define on Carbon. * emacsclient.c (decode_options): Don't use a tty on mac carbon.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sat, 19 May 2007 23:12:46 +0000
parents 5da6a46ddbd6
children 337111eac6a6
files lib-src/ChangeLog.multi-tty lib-src/emacsclient.c lisp/ChangeLog.multi-tty lisp/loadup.el lisp/term/mac-win.el src/ChangeLog.multi-tty src/frame.c src/macfns.c src/s/darwin.h
diffstat 9 files changed, 105 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog.multi-tty	Sat May 19 19:08:02 2007 +0000
+++ b/lib-src/ChangeLog.multi-tty	Sat May 19 23:12:46 2007 +0000
@@ -1,3 +1,7 @@
+2007-05-19  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* emacsclient.c (decode_options): Don't use a tty on mac carbon.
+
 2007-05-17  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* emacsclient.c (handle_sigtstp): Use the new name for the
--- a/lib-src/emacsclient.c	Sat May 19 19:08:02 2007 +0000
+++ b/lib-src/emacsclient.c	Sat May 19 23:12:46 2007 +0000
@@ -458,7 +458,7 @@
 
   if (!tty && display)
     window_system = 1;
-#ifndef WINDOWSNT
+#if !defined (WINDOWSNT) && !defined (HAVE_CARBON)
   else
     tty = 1;
 #endif
--- a/lisp/ChangeLog.multi-tty	Sat May 19 19:08:02 2007 +0000
+++ b/lisp/ChangeLog.multi-tty	Sat May 19 23:12:46 2007 +0000
@@ -6,8 +6,11 @@
 	here.
 	(handle-args-function-alist, frame-creation-function-alist):
 	(window-system-initialization-alist): Add mac entries.
+	(x-setup-function-keys): New function containing all the
+	top level function key definitions.
 
-	* loadup.el: Load mac-win on a Mac.
+	* loadup.el: Load mac-win on a Mac. Avoid loading both x-win and
+	mac-win.
 
 2007-05-17  Jason Rumney  <jasonr@gnu.org>
 
--- a/lisp/loadup.el	Sat May 19 19:08:02 2007 +0000
+++ b/lisp/loadup.el	Sat May 19 23:12:46 2007 +0000
@@ -212,7 +212,7 @@
 (if (eq system-type 'macos)
     (progn
       (load "ls-lisp")))
-(if (eq system-type 'darwin)
+(if (and (eq system-type 'darwin) (not (featurep 'x)))
     (progn
       (load "term/mac-win")))
 (if (fboundp 'atan)	; preload some constants and
--- a/lisp/term/mac-win.el	Sat May 19 19:08:02 2007 +0000
+++ b/lisp/term/mac-win.el	Sat May 19 23:12:46 2007 +0000
@@ -1062,6 +1062,8 @@
 (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
 			   global-map)
 
+(defun x-setup-function-keys (frame)
+  "Setup Function Keys for mac."
 ;; Map certain keypad keys into ASCII characters
 ;; that people usually expect.
 (define-key local-function-key-map [backspace] [?\d])
@@ -1078,6 +1080,7 @@
 (define-key local-function-key-map [M-clear] [?\M-\C-l])
 (define-key local-function-key-map [M-return] [?\M-\C-m])
 (define-key local-function-key-map [M-escape] [?\M-\e])
+)
 
 ;; These tell read-char how to convert
 ;; these special chars to ASCII.
@@ -2281,34 +2284,6 @@
 	  (mac-dnd-drop-data event (selected-frame) window
 			     (cdr item) (car item) action)))))
 
-;;; Do the actual Windows setup here; the above code just defines
-;;; functions and variables that we use now.
-
-(setq command-line-args (x-handle-args command-line-args))
-
-;;; Make sure we have a valid resource name.
-(or (stringp x-resource-name)
-    (let (i)
-      (setq x-resource-name (invocation-name))
-
-      ;; Change any . or * characters in x-resource-name to hyphens,
-      ;; so as not to choke when we use it in X resource queries.
-      (while (setq i (string-match "[.*]" x-resource-name))
-	(aset x-resource-name i ?-))))
-
-(if (x-display-list)
-    ;; On Mac OS 8/9, Most coding systems used in code conversion for
-    ;; font names are not ready at the time when the terminal frame is
-    ;; created.  So we reconstruct font name table for the initial
-    ;; frame.
-    (mac-clear-font-name-table)
-  (x-open-connection "Mac"
-		     x-command-line-resources
-		     ;; Exit Emacs with fatal error if this fails.
-		     t))
-
-(setq frame-creation-function 'x-create-frame-with-faces)
-
 (defvar mac-font-encoder-list
   '(("mac-roman" mac-roman-encoder
      ccl-encode-mac-roman-font "%s")
@@ -2486,6 +2461,88 @@
     (fontset-add-mac-fonts fontset t)
     fontset))
 
+(defun x-win-suspend-error ()
+  (error "Suspending an Emacs running under Mac makes no sense"))
+
+(defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value)
+
+(defvar mac-initialized nil
+  "Non-nil if the w32 window system has been initialized.")
+
+(defun mac-initialize-window-system ()
+  "Initialize Emacs for Mac GUI frames."
+
+;;; Do the actual Windows setup here; the above code just defines
+;;; functions and variables that we use now.
+
+(setq command-line-args (x-handle-args command-line-args))
+
+;;; Make sure we have a valid resource name.
+(or (stringp x-resource-name)
+    (let (i)
+      (setq x-resource-name (invocation-name))
+
+      ;; Change any . or * characters in x-resource-name to hyphens,
+      ;; so as not to choke when we use it in X resource queries.
+      (while (setq i (string-match "[.*]" x-resource-name))
+	(aset x-resource-name i ?-))))
+
+(if (x-display-list)
+    ;; On Mac OS 8/9, Most coding systems used in code conversion for
+    ;; font names are not ready at the time when the terminal frame is
+    ;; created.  So we reconstruct font name table for the initial
+    ;; frame.
+    (mac-clear-font-name-table)
+  (x-open-connection "Mac"
+		     x-command-line-resources
+		     ;; Exit Emacs with fatal error if this fails.
+		     t))
+
+(add-hook 'suspend-hook 'x-win-suspend-error)
+
+;;; Arrange for the kill and yank functions to set and check the clipboard.
+(setq interprogram-cut-function 'x-select-text)
+(setq interprogram-paste-function 'x-get-selection-value)
+
+
+
+
+;;; Turn off window-splitting optimization; Mac is usually fast enough
+;;; that this is only annoying.
+(setq split-window-keep-point t)
+
+;; Don't show the frame name; that's redundant.
+(setq-default mode-line-frame-identification "  ")
+
+;; Turn on support for mouse wheels.
+(mouse-wheel-mode 1)
+
+
+;; Enable CLIPBOARD copy/paste through menu bar commands.
+(menu-bar-enable-clipboard)
+
+
+;; Initiate drag and drop
+
+(define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
+
+
+;;;; Non-toolkit Scroll bars
+
+(unless x-toolkit-scroll-bars
+
+;; for debugging
+;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event))
+
+;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event)
+
+(global-set-key
+ [vertical-scroll-bar down-mouse-1]
+ 'mac-handle-scroll-bar-event)
+
+(global-unset-key [vertical-scroll-bar drag-mouse-1])
+(global-unset-key [vertical-scroll-bar mouse-1])
+
 ;; Adjust Courier font specifications in x-fixed-font-alist.
 (let ((courier-fonts (assoc "Courier" x-fixed-font-alist)))
   (if courier-fonts
@@ -2592,62 +2649,6 @@
 	(setq default-frame-alist
 	      (cons '(reverse . t) default-frame-alist)))))
 
-(defun x-win-suspend-error ()
-  (error "Suspending an Emacs running under Mac makes no sense"))
-
-(defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value)
-
-(defvar mac-initialized nil
-  "Non-nil if the w32 window system has been initialized.")
-
-(defun mac-initialize-window-system ()
-  "Initialize Emacs for Mac GUI frames."
-
-(add-hook 'suspend-hook 'x-win-suspend-error)
-
-;;; Arrange for the kill and yank functions to set and check the clipboard.
-(setq interprogram-cut-function 'x-select-text)
-(setq interprogram-paste-function 'x-get-selection-value)
-
-
-
-
-;;; Turn off window-splitting optimization; Mac is usually fast enough
-;;; that this is only annoying.
-(setq split-window-keep-point t)
-
-;; Don't show the frame name; that's redundant.
-(setq-default mode-line-frame-identification "  ")
-
-;; Turn on support for mouse wheels.
-(mouse-wheel-mode 1)
-
-
-;; Enable CLIPBOARD copy/paste through menu bar commands.
-(menu-bar-enable-clipboard)
-
-
-;; Initiate drag and drop
-
-(define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
-
-
-;;;; Non-toolkit Scroll bars
-
-(unless x-toolkit-scroll-bars
-
-;; for debugging
-;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event))
-
-;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event)
-
-(global-set-key
- [vertical-scroll-bar down-mouse-1]
- 'mac-handle-scroll-bar-event)
-
-(global-unset-key [vertical-scroll-bar drag-mouse-1])
-(global-unset-key [vertical-scroll-bar mouse-1])
-
 (setq mac-initialized t)))
 
 (defun mac-handle-scroll-bar-event (event)
--- a/src/ChangeLog.multi-tty	Sat May 19 19:08:02 2007 +0000
+++ b/src/ChangeLog.multi-tty	Sat May 19 23:12:46 2007 +0000
@@ -1,6 +1,9 @@
 2007-05-19  Dan Nicolaescu  <dann@ics.uci.edu>
 
+	* frame.c (Fmake_terminal_frame): Disable output method test. 
+
 	* s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
+	(SYSTEM_PURESIZE_EXTRA): Only define on Carbon.
 
 	* termhooks.h (union display_info): Add mac_display_info.
 
@@ -32,6 +35,7 @@
 	(Fx_open_connection): Remove window-system check.
 	(start_hourglass): Likewise.
 	(x_create_tip_frame): Get the keyboard from the terminal.
+	(Fx_create_frame): Don't use FRAME_MAC_DISPLAY_INFO.
 
 	* w32fns.c (Fx_create_frame): Use kboard from the terminal.
 
--- a/src/frame.c	Sat May 19 19:08:02 2007 +0000
+++ b/src/frame.c	Sat May 19 23:12:46 2007 +0000
@@ -702,7 +702,9 @@
     abort ();
 #else /* not MSDOS */
 
-#ifdef MAC_OS
+#if 0 /* #ifdef MAC_OS */
+  /* This can happen for multi-tty when using both terminal frames and
+     Carbon frames. */
   if (sf->output_method != output_mac)
     error ("Not running on a Macintosh screen; cannot make a new Macintosh frame");
 #else
--- a/src/macfns.c	Sat May 19 19:08:02 2007 +0000
+++ b/src/macfns.c	Sat May 19 23:12:46 2007 +0000
@@ -2590,7 +2590,7 @@
     f->icon_name = Qnil;
 
   /* XXX Is this needed? */
-  FRAME_MAC_DISPLAY_INFO (f) = dpyinfo;
+  /*FRAME_MAC_DISPLAY_INFO (f) = dpyinfo;*/
 
   /* With FRAME_MAC_DISPLAY_INFO set up, this unwind-protect is safe.  */
 #if GLYPH_DEBUG
--- a/src/s/darwin.h	Sat May 19 19:08:02 2007 +0000
+++ b/src/s/darwin.h	Sat May 19 23:12:46 2007 +0000
@@ -50,13 +50,11 @@
 #ifdef MAC_OSX
 #ifdef HAVE_CARBON
 #define MAC_OS
+/* We need a little extra space, see ../../lisp/loadup.el. */
+#define SYSTEM_PURESIZE_EXTRA 30000
 #endif
 #endif
 
-/* We need a little extra space, see ../../lisp/loadup.el. */
-#define SYSTEM_PURESIZE_EXTRA 30000
-
-
 /* SYSTEM_TYPE should indicate the kind of system you are using.
  It sets the Lisp variable system-type.  */