Merged from miles@gnu.org--gnu-2005 (patch 441-446)
[bpt/emacs.git] / src / frame.c
index 6c8f837..6a54e26 100644 (file)
@@ -426,7 +426,7 @@ make_frame_without_minibuffer (mini_window, kb, display)
 #ifdef MULTI_KBOARD
   if (!NILP (mini_window)
       && XFRAME (XWINDOW (mini_window)->frame)->kboard != kb)
-    error ("frame and minibuffer must be on the same display");
+    error ("Frame and minibuffer must be on the same display");
 #endif
 
   /* Make a frame containing just a root window.  */
@@ -698,9 +698,7 @@ affects all frames on the same terminal device.  */)
       {
         display_device = XCDR (display_device);
         CHECK_NUMBER (display_device);
-        d = get_display (XINT (display_device));
-        if (!d)
-          wrong_type_argument (Qdisplay_live_p, display_device);
+        d = get_display (XINT (display_device), 1);
       }
   }
   
@@ -907,7 +905,7 @@ do_switch_frame (frame, track, for_deletion)
   return frame;
 }
 
-DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 2, "e",
+DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 1, "e",
        doc: /* Select the frame FRAME.
 Subsequent editing commands apply to its selected window.
 The selection of FRAME lasts until the next time the user does
@@ -918,14 +916,14 @@ the command loop, because it still may have the window system's input
 focus.  On a text-only terminal, the next redisplay will display FRAME.
 
 This function returns FRAME, or nil if FRAME has been deleted.  */)
-  (frame, no_enter)
-    Lisp_Object frame, no_enter;
+  (frame)
+    Lisp_Object frame;
 {
   return do_switch_frame (frame, 1, 0);
 }
 
 
-DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 2, "e",
+DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 1, "e",
        doc: /* Handle a switch-frame event EVENT.
 Switch-frame events are usually bound to this function.
 A switch-frame event tells Emacs that the window manager has requested
@@ -934,8 +932,8 @@ This function selects the selected window of the frame of EVENT.
 
 If EVENT is frame object, handle it as if it were a switch-frame event
 to that frame.  */)
-     (event, no_enter)
-     Lisp_Object event, no_enter;
+     (event)
+     Lisp_Object event;
 {
   /* Preserve prefix arg that the command loop just cleared.  */
   current_kboard->Vprefix_arg = Vcurrent_prefix_arg;
@@ -943,32 +941,6 @@ to that frame.  */)
   return do_switch_frame (event, 0, 0);
 }
 
-DEFUN ("ignore-event", Fignore_event, Signore_event, 0, 0, "",
-       doc: /* Do nothing.
-This is a suitable binding for `iconify-frame' and `make-frame-visible'.  */)
-     ()
-{
-  /* Contrary to `handle-switch-frame', `ignore-event' is used from
-     `special-event-map'.  Commands from that map are run in a special
-     way that automatically preserves the prefix-arg.  Restoring
-     the prefix arg here is not just redundant but harmful:
-     - C-u C-x v =
-     - current-prefix-arg is set to non-nil, prefix-arg is set to nil.
-     - after the first prompt, the exit-minibuffer-hook is run which may
-       iconify a frame and thus push a `iconify-frame' event.
-     - after running exit-minibuffer-hook, current-prefix-arg is
-       restored to the non-nil value it had before the prompt.
-     - we enter the second prompt.
-       current-prefix-arg is non-nil, prefix-arg is nil.
-     - before running the first real event, we run the special iconify-frame
-       event, but we pass the `special' arg to execute-command so
-       current-prefix-arg and prefix-arg are left untouched.
-     - here we foolishly copy the non-nil current-prefix-arg to prefix-arg.
-     - the next key event will have a spuriously non-nil current-prefix-arg.
-  current_kboard->Vprefix_arg = Vcurrent_prefix_arg; */
-  return Qnil;
-}
-
 DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
        doc: /* Return the frame that is now selected.  */)
      ()
@@ -1099,7 +1071,7 @@ The display device is represented by its integer identifier.  */)
 
   CHECK_LIVE_FRAME (frame);
 
-  d = get_display (frame);
+  d = get_display (frame, 0);
 
   if (!d)
     return Qnil;
@@ -1499,6 +1471,10 @@ The functions are run with one arg, the frame to be deleted.  */)
   if (FRAME_X_P (f))
     x_clear_frame_selections (f);
 #endif
+#ifdef MAC_OS
+  if (FRAME_MAC_P (f))
+    x_clear_frame_selections (f);
+#endif
 
   /* Free glyphs.
      This function must be called before the window tree of the
@@ -1778,7 +1754,7 @@ before calling this function on it, like this.
 #if defined (MSDOS) && defined (HAVE_MOUSE)
   if (FRAME_MSDOS_P (XFRAME (frame)))
     {
-      Fselect_frame (frame, Qnil);
+      Fselect_frame (frame);
       mouse_moveto (XINT (x), XINT (y));
     }
 #endif
@@ -1810,7 +1786,7 @@ before calling this function on it, like this.
 #if defined (MSDOS) && defined (HAVE_MOUSE)
   if (FRAME_MSDOS_P (XFRAME (frame)))
     {
-      Fselect_frame (frame, Qnil);
+      Fselect_frame (frame);
       mouse_moveto (XINT (x), XINT (y));
     }
 #endif
@@ -1932,7 +1908,7 @@ If omitted, FRAME defaults to the currently selected frame.  */)
 #if 0 /* This isn't logically necessary, and it can do GC.  */
   /* Don't let the frame remain selected.  */
   if (EQ (frame, selected_frame))
-    Fhandle_switch_frame (next_frame (frame, Qt), Qnil);
+    Fhandle_switch_frame (next_frame (frame, Qt));
 #endif
 
   /* Don't allow minibuf_window to remain on a deleted frame.  */
@@ -2572,6 +2548,12 @@ enabled such bindings for that variable with `make-variable-frame-local'.  */)
          prop = parms[i];
          val = values[i];
          store_frame_param (f, prop, val);
+
+         /* Changing the background color might change the background
+            mode, so that we have to load new defface specs.
+            Call frame-set-background-mode to do that.  */
+         if (EQ (prop, Qbackground_color))
+           call1 (Qframe_set_background_mode, frame);
        }
     }
 
@@ -3627,7 +3609,7 @@ extern char *x_get_string_resource P_ ((XrmDatabase, char *, char *));
 extern Display_Info *check_x_display_info P_ ((Lisp_Object));
 
 
-/* Get specified attribute from resource database RDB.  
+/* Get specified attribute from resource database RDB.
    See Fx_get_resource below for other parameters.  */
 
 static Lisp_Object
@@ -3764,7 +3746,7 @@ x_get_resource_string (attribute, class)
 
 Lisp_Object
 x_get_arg (dpyinfo, alist, param, attribute, class, type)
-     Display_Info *dpyinfo; 
+     Display_Info *dpyinfo;
      Lisp_Object alist, param;
      char *attribute;
      char *class;
@@ -4376,7 +4358,6 @@ This variable is local to the current terminal and cannot be buffer-local.  */);
   defsubr (&Swindow_system);
   defsubr (&Smake_terminal_frame);
   defsubr (&Shandle_switch_frame);
-  defsubr (&Signore_event);
   defsubr (&Sselect_frame);
   defsubr (&Sselected_frame);
   defsubr (&Swindow_frame);