]> code.delx.au - gnu-emacs/blobdiff - src/frame.c
Merge from emacs--rel--22
[gnu-emacs] / src / frame.c
index 5b8f9acaf0c944e2f00da49d13a4652cd28f71cc..ff860d83509286abaa970a0e44a262a60af796ca 100644 (file)
@@ -6,7 +6,7 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -103,6 +103,7 @@ Lisp_Object Qouter_window_id;
 #endif
 Lisp_Object Qparent_id;
 Lisp_Object Qtitle, Qname;
+Lisp_Object Qexplicit_name;
 Lisp_Object Qunsplittable;
 Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
 Lisp_Object Qleft_fringe, Qright_fringe;
@@ -110,7 +111,6 @@ Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list;
 Lisp_Object Qtty_color_mode;
 Lisp_Object Qtty, Qtty_type;
 Lisp_Object Qwindow_system;
-Lisp_Object Qenvironment;
 
 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
 
@@ -123,6 +123,8 @@ Lisp_Object Vdefault_frame_scroll_bars;
 Lisp_Object Vmouse_position_function;
 Lisp_Object Vmouse_highlight;
 Lisp_Object Vdelete_frame_functions;
+
+int focus_follows_mouse;
 \f
 static void
 set_menu_bar_lines_1 (window, n)
@@ -562,8 +564,8 @@ make_terminal_frame (struct terminal *terminal)
   Lisp_Object frame;
   char name[20];
 
-  if (terminal->deleted)
-    error ("Terminal is being deleted, can't create new frames on it");
+  if (!terminal->name)
+    error ("Terminal is not live, can't create new frames on it");
 
   f = make_frame (1);
 
@@ -601,12 +603,6 @@ make_terminal_frame (struct terminal *terminal)
   else
     f->output_method = output_termcap;
 #else
-#ifdef WINDOWSNT
-  f->output_method = output_termcap;
-  f->terminal = terminal;
-  f->terminal->reference_count++;
-  create_w32cons_output (f);
-#else
 #ifdef MAC_OS8
   make_mac_terminal_frame (f);
 #else
@@ -623,7 +619,7 @@ make_terminal_frame (struct terminal *terminal)
     FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
 
     /* Set the top frame to the newly created frame. */
-    if (FRAME_TTY (f)->top_frame
+    if (FRAMEP (FRAME_TTY (f)->top_frame)
         && FRAME_LIVE_P (XFRAME (FRAME_TTY (f)->top_frame)))
       XFRAME (FRAME_TTY (f)->top_frame)->async_visible = 2; /* obscured */
     
@@ -635,7 +631,6 @@ make_terminal_frame (struct terminal *terminal)
   FRAME_BACKGROUND_PIXEL(f) = FACE_TTY_DEFAULT_BG_COLOR;
 #endif
 #endif /* MAC_OS8 */
-#endif /* WINDOWSNT */
 #endif /* MSDOS */
 
   if (!noninteractive)
@@ -1474,24 +1469,6 @@ The functions are run with one arg, the frame to be deleted.  */)
   if (EQ (f->minibuffer_window, echo_area_window))
     echo_area_window = sf->minibuffer_window;
 
-  /* Don't allow other frames to refer to a deleted frame in their
-     'environment parameter.  */
-  {
-    Lisp_Object tail, frame1;
-    Lisp_Object env = get_frame_param (XFRAME (frame), Qenvironment);
-    FOR_EACH_FRAME (tail, frame1)
-      {
-        if (EQ (frame, frame1) || !FRAME_LIVE_P (XFRAME (frame1)))
-          continue;
-        if (EQ (frame, get_frame_param (XFRAME (frame1), Qenvironment)))
-          {
-            store_frame_param (XFRAME (frame1), Qenvironment, env);
-            if (!FRAMEP (env))
-              env = frame1;
-          }
-      }
-  }
-  
   /* Clear any X selections for this frame.  */
 #ifdef HAVE_X_WINDOWS
   if (FRAME_X_P (f))
@@ -1706,7 +1683,7 @@ and returns whatever that function returns.  */)
   f = SELECTED_FRAME ();
   x = y = Qnil;
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   /* It's okay for the hook to refrain from storing anything.  */
   if (FRAME_TERMINAL (f)->mouse_position_hook)
     (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
@@ -1750,7 +1727,7 @@ and nil for X and Y.  */)
   f = SELECTED_FRAME ();
   x = y = Qnil;
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   /* It's okay for the hook to refrain from storing anything.  */
   if (FRAME_TERMINAL (f)->mouse_position_hook)
     (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
@@ -1795,6 +1772,13 @@ before calling this function on it, like this.
       Fselect_frame (frame);
       mouse_moveto (XINT (x), XINT (y));
     }
+#else
+#ifdef HAVE_GPM
+    {
+      Fselect_frame (frame);
+      term_mouse_moveto (XINT (x), XINT (y));
+    }
+#endif
 #endif
 #endif
 
@@ -1830,6 +1814,13 @@ before calling this function on it, like this.
       Fselect_frame (frame);
       mouse_moveto (XINT (x), XINT (y));
     }
+#else
+#ifdef HAVE_GPM
+    {
+      Fselect_frame (frame);
+      term_mouse_moveto (XINT (x), XINT (y));
+    }
+#endif
 #endif
 #endif
 
@@ -2384,7 +2375,7 @@ If FRAME is omitted, return information on the currently selected frame.  */)
         unspecified and reversed, take the frame's background pixel
         for foreground and vice versa.  */
       elt = Fassq (Qforeground_color, alist);
-      if (!NILP (elt) && CONSP (elt) && STRINGP (XCDR (elt)))
+      if (CONSP (elt) && STRINGP (XCDR (elt)))
        {
          if (strncmp (SDATA (XCDR (elt)),
                       unspecified_bg,
@@ -2398,7 +2389,7 @@ If FRAME is omitted, return information on the currently selected frame.  */)
       else
        store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg));
       elt = Fassq (Qbackground_color, alist);
-      if (!NILP (elt) && CONSP (elt) && STRINGP (XCDR (elt)))
+      if (CONSP (elt) && STRINGP (XCDR (elt)))
        {
          if (strncmp (SDATA (XCDR (elt)),
                       unspecified_fg,
@@ -2597,44 +2588,8 @@ enabled such bindings for that variable with `make-variable-frame-local'.  */)
            call1 (Qframe_set_background_mode, frame);
        }
     }
+  return Qnil;
 }
-
-DEFUN ("frame-with-environment", Fframe_with_environment, Sframe_with_environment, 0, 1, 0,
-       doc: /* Return the frame that has the environment variable list for FRAME.
-
-The frame-local environment variable list is normally shared between
-frames that were created in the same Emacsclient session.  The
-environment list is stored in a single frame's 'environment parameter;
-the other frames' 'environment parameter is set to this frame.  This
-function follows the chain of 'environment references to reach the
-frame that stores the actual local environment list, and returns that
-frame.  */)
-     (frame)
-     Lisp_Object frame;
-{
-  Lisp_Object hare, tortoise;
-
-  if (NILP (frame))
-    frame = selected_frame;
-  CHECK_FRAME (frame);
-
-  hare = tortoise = get_frame_param (XFRAME (frame), Qenvironment);
-  while (!NILP (hare) && FRAMEP (hare))
-    {
-      frame = hare;
-      hare = get_frame_param (XFRAME (hare), Qenvironment);
-      if (NILP (hare) || !FRAMEP (hare))
-        break;
-      frame = hare;
-      hare = get_frame_param (XFRAME (hare), Qenvironment);
-      tortoise = get_frame_param (XFRAME (tortoise), Qenvironment);
-      if (EQ (hare, tortoise))
-        error ("Cyclic frame-local environment indirection");
-    }
-
-  return frame;
-}
-
 \f
 DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height,
        0, 1, 0,
@@ -3066,9 +3021,9 @@ x_set_frame_parameters (f, alist)
       prop = parms[i];
       val = values[i];
 
-      if (EQ (prop, Qwidth) && NUMBERP (val))
+      if (EQ (prop, Qwidth) && NATNUMP (val))
        width = XFASTINT (val);
-      else if (EQ (prop, Qheight) && NUMBERP (val))
+      else if (EQ (prop, Qheight) && NATNUMP (val))
        height = XFASTINT (val);
       else if (EQ (prop, Qtop))
        top = val;
@@ -3314,6 +3269,7 @@ x_report_frame_params (f, alistptr)
     tem = Qnil;
   else
     XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc);
+  store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil));
   store_in_alist (alistptr, Qparent_id, tem);
 }
 
@@ -4275,6 +4231,8 @@ syms_of_frame ()
   staticpro (&Qframep);
   Qframe_live_p = intern ("frame-live-p");
   staticpro (&Qframe_live_p);
+  Qexplicit_name = intern ("explicit-name");
+  staticpro (&Qexplicit_name);
   Qheight = intern ("height");
   staticpro (&Qheight);
   Qicon = intern ("icon");
@@ -4337,9 +4295,7 @@ syms_of_frame ()
   staticpro (&Qtty_type);
   Qwindow_system = intern ("window-system");
   staticpro (&Qwindow_system);
-  Qenvironment = intern ("environment");
-  staticpro (&Qenvironment);
-  
+
   Qface_set_after_frame_default = intern ("face-set-after-frame-default");
   staticpro (&Qface_set_after_frame_default);
 
@@ -4484,6 +4440,21 @@ displayed.
 
 This variable is local to the current terminal and cannot be buffer-local.  */);
 
+  DEFVAR_BOOL ("focus-follows-mouse", &focus_follows_mouse,
+              doc: /* Non-nil if window system changes focus when you move the mouse.
+You should set this variable to tell Emacs how your window manager
+handles focus, since there is no way in general for Emacs to find out
+automatically.  */);
+#ifdef HAVE_WINDOW_SYSTEM
+#if defined(HAVE_NTGUI) || defined(MAC_OS)
+  focus_follows_mouse = 0;
+#else
+  focus_follows_mouse = 1;
+#endif
+#else
+  focus_follows_mouse = 0;
+#endif
+        
   staticpro (&Vframe_list);
 
   defsubr (&Sactive_minibuffer_window);
@@ -4523,7 +4494,6 @@ This variable is local to the current terminal and cannot be buffer-local.  */);
   defsubr (&Sframe_parameters);
   defsubr (&Sframe_parameter);
   defsubr (&Smodify_frame_parameters);
-  defsubr (&Sframe_with_environment);
   defsubr (&Sframe_char_height);
   defsubr (&Sframe_char_width);
   defsubr (&Sframe_pixel_height);