]> code.delx.au - gnu-emacs/blobdiff - lisp/frame.el
Tue Dec 1 22:34:42 1992 Jim Blandy (jimb@totoro.cs.oberlin.edu)
[gnu-emacs] / lisp / frame.el
index 734357ffd5f5d67b745a2e56db64ea700ca17566..d679f136eadd39649a69ece50cd1a46d7375bbee 100644 (file)
@@ -1,10 +1,10 @@
 ;;; frame.el --- multi-frame management independent of window systems.
 
 ;;; frame.el --- multi-frame management independent of window systems.
 
-;; Maintainer: FSF
-;; Last-Modified: 09 Jul 92
-
 ;;;; Copyright (C) 1990, 1992 Free Software Foundation, Inc.
 
 ;;;; Copyright (C) 1990, 1992 Free Software Foundation, Inc.
 
+;; Maintainer: FSF
+;; Keywords: internal
+
 ;;; This file is part of GNU Emacs.
 ;;;
 ;;; GNU Emacs is free software; you can redistribute it and/or modify
 ;;; This file is part of GNU Emacs.
 ;;;
 ;;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@ function, which should take an alist of parameters as its argument.")
 ;;; The default value for this must ask for a minibuffer.  There must
 ;;; always exist a frame with a minibuffer, and after we delete the
 ;;; terminal frame, this will be the only frame.
 ;;; The default value for this must ask for a minibuffer.  There must
 ;;; always exist a frame with a minibuffer, and after we delete the
 ;;; terminal frame, this will be the only frame.
-(defvar initial-frame-alist '((minibuffer . nil))
+(defvar initial-frame-alist '((minibuffer . t))
   "Alist of values used when creating the initial emacs text frame.
 These may be set in your init file, like this:
  (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55)))
   "Alist of values used when creating the initial emacs text frame.
 These may be set in your init file, like this:
  (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55)))
@@ -115,10 +115,14 @@ These supercede the values given in default-frame-alist.")
 (defun frame-notice-user-settings ()
   (if frame-initial-frame
       (progn
 (defun frame-notice-user-settings ()
   (if frame-initial-frame
       (progn
-       
        ;; If the user wants a minibuffer-only frame, we'll have to
        ;; make a new one; you can't remove or add a root window to/from
        ;; an existing frame.
        ;; If the user wants a minibuffer-only frame, we'll have to
        ;; make a new one; you can't remove or add a root window to/from
        ;; an existing frame.
+       ;; NOTE: default-frame-alist was nil when we created the
+       ;; existing frame.  We need to explicitly include
+       ;; default-frame-alist in the parameters of the screen we
+       ;; create here, so that its new value, gleaned from the user's
+       ;; .emacs file, will be applied to the existing screen.
        (if (eq (cdr (or (assq 'minibuffer initial-frame-alist)
                         '(minibuffer . t)))
                     'only)
        (if (eq (cdr (or (assq 'minibuffer initial-frame-alist)
                         '(minibuffer . t)))
                     'only)
@@ -126,10 +130,18 @@ These supercede the values given in default-frame-alist.")
              (setq default-minibuffer-frame
                    (new-frame
                     (append initial-frame-alist
              (setq default-minibuffer-frame
                    (new-frame
                     (append initial-frame-alist
+                            default-frame-alist
                             (frame-parameters frame-initial-frame))))
                             (frame-parameters frame-initial-frame))))
+
+             ;; Redirect events enqueued at this frame to the new frame.
+             ;; Is this a good idea?
+             (redirect-frame-focus frame-initial-frame
+                                   default-minibuffer-frame)
+
              (delete-frame frame-initial-frame))
          (modify-frame-parameters frame-initial-frame
              (delete-frame frame-initial-frame))
          (modify-frame-parameters frame-initial-frame
-                                   initial-frame-alist))))
+                                  (append initial-frame-alist
+                                          default-frame-alist)))))
 
   ;; Make sure the initial frame can be GC'd if it is ever deleted.
   (makunbound 'frame-initial-frame))
 
   ;; Make sure the initial frame can be GC'd if it is ever deleted.
   (makunbound 'frame-initial-frame))
@@ -140,7 +152,7 @@ These supercede the values given in default-frame-alist.")
 ;;; Return some frame other than the current frame,
 ;;; creating one if neccessary.  Note that the minibuffer frame, if
 ;;; separate, is not considered (see next-frame).
 ;;; Return some frame other than the current frame,
 ;;; creating one if neccessary.  Note that the minibuffer frame, if
 ;;; separate, is not considered (see next-frame).
-(defun get-frame ()
+(defun get-other-frame ()
   (let ((s (if (equal (next-frame (selected-frame)) (selected-frame))
               (new-frame)
             (next-frame (selected-frame)))))
   (let ((s (if (equal (next-frame (selected-frame)) (selected-frame))
               (new-frame)
             (next-frame (selected-frame)))))
@@ -192,22 +204,6 @@ under the X Window System."
   (interactive)
   (funcall frame-creation-function parameters))
 
   (interactive)
   (funcall frame-creation-function parameters))
 
-\f
-;;;; Iconification
-
-;;; A possible enhancement for the below: if you iconify a surrogate
-;;; minibuffer frame, iconify all of its minibuffer's users too; 
-;;; de-iconify them as a group.  This will need to wait until frames
-;;; have mapping and unmapping hooks.
-
-(defun iconify ()
-  "Iconify or deiconify the selected frame."
-  (interactive)
-  (let ((frame (selected-frame)))
-    (if (eq (frame-visible-p frame) t)
-       (iconify-frame frame)
-      (make-frame-visible frame))))
-
 \f
 ;;;; Frame configurations
 
 \f
 ;;;; Frame configurations
 
@@ -244,27 +240,15 @@ configuration, and other parameters set as specified in CONFIGURATION."
 ;;;; Convenience functions for accessing and interactively changing
 ;;;; frame parameters.
 
 ;;;; Convenience functions for accessing and interactively changing
 ;;;; frame parameters.
 
-(defun frame-width (&optional frame)
+(defun frame-height (&optional frame)
   "Return number of lines available for display on FRAME.
 If FRAME is omitted, describe the currently selected frame."
   "Return number of lines available for display on FRAME.
 If FRAME is omitted, describe the currently selected frame."
-  (cdr (assq 'width (frame-parameters frame))))
+  (cdr (assq 'height (frame-parameters frame))))
 
 (defun frame-width (&optional frame)
   "Return number of columns available for display on FRAME.
 If FRAME is omitted, describe the currently selected frame."
 
 (defun frame-width (&optional frame)
   "Return number of columns available for display on FRAME.
 If FRAME is omitted, describe the currently selected frame."
-  (cdr (assq 'height (frame-parameters frame))))
-
-(defun set-frame-height (h)
-  (interactive "NHeight: ")
-  (let* ((frame (selected-frame))
-        (width (cdr (assoc 'width (frame-parameters (selected-frame))))))
-    (set-frame-size (selected-frame) width h)))
-
-(defun set-frame-width (w)
-  (interactive "NWidth: ")
-  (let* ((frame (selected-frame))
-        (height (cdr (assoc 'height (frame-parameters (selected-frame))))))
-    (set-frame-size (selected-frame) w height)))
+  (cdr (assq 'width (frame-parameters frame))))
 
 (defun set-default-font (font-name)
   (interactive "sFont name: ")
 
 (defun set-default-font (font-name)
   (interactive "sFont name: ")
@@ -314,8 +298,27 @@ If FRAME is omitted, describe the currently selected frame."
 ;;;; Aliases for backward compatibility with Emacs 18.
 (fset 'screen-height 'frame-height)
 (fset 'screen-width 'frame-width)
 ;;;; Aliases for backward compatibility with Emacs 18.
 (fset 'screen-height 'frame-height)
 (fset 'screen-width 'frame-width)
-(fset 'set-screen-width 'set-frame-width)
-(fset 'set-screen-height 'set-frame-height)
+
+(defun set-screen-width (cols &optional pretend)
+  "Obsolete function to change the size of the screen to COLS columns.\n\
+Optional second arg non-nil means that redisplay should use COLS columns\n\
+but that the idea of the actual width of the frame should not be changed.\n\
+This function is provided only for compatibility with Emacs 18; new code\n\
+should use `set-frame-width instead'."
+  (set-frame-width (selected-frame) cols pretend))
+
+(defun set-screen-height (lines &optional pretend)
+  "Obsolete function to change the height of the screen to LINES lines.\n\
+Optional second arg non-nil means that redisplay should use LINES lines\n\
+but that the idea of the actual height of the screen should not be changed.\n\
+This function is provided only for compatibility with Emacs 18; new code\n\
+should use `set-frame-width' instead."
+  (set-frame-height (selected-frame) lines pretend))
+
+(make-obsolete 'screen-height 'frame-height)
+(make-obsolete 'screen-width  'frame-width)
+(make-obsolete 'set-screen-width 'set-frame-width)
+(make-obsolete 'set-screen-height 'set-frame-height)
 
 \f
 ;;;; Key bindings
 
 \f
 ;;;; Key bindings