/* Generic frame functions.
- Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2003, 2004, 2005
- Free Software Foundation.
+ Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Emacs.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
#include <config.h>
Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
+Lisp_Object Qinhibit_face_set_after_frame_default;
Lisp_Object Qface_set_after_frame_default;
#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. */
If MINIBUF is 0, include all visible and iconified frames.
Otherwise, include all frames. */
-Lisp_Object
+static Lisp_Object
next_frame (frame, minibuf)
Lisp_Object frame;
Lisp_Object minibuf;
If MINIBUF is 0, include all visible and iconified frames.
Otherwise, include all frames. */
-Lisp_Object
+static Lisp_Object
prev_frame (frame, minibuf)
Lisp_Object frame;
Lisp_Object minibuf;
DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
The position is given in character cells, where (0, 0) is the
-upper-left corner.
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
If Emacs is running on a mouseless terminal or hasn't been programmed
to read the mouse position, it returns the selected frame for FRAME
and nil for X and Y.
Smouse_pixel_position, 0, 0, 0,
doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
The position is given in pixel units, where (0, 0) is the
-upper-left corner.
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
If Emacs is running on a mouseless terminal or hasn't been programmed
to read the mouse position, it returns the selected frame for FRAME
and nil for X and Y. */)
so the coordinates of the top left character in the frame
may be nonzero due to left-hand scroll bars or the menu bar.
+The position is given in character cells, where (0, 0) is the
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
+
This function is a no-op for an X frame that is not visible.
If you have just created a frame, you must wait for it to become visible
before calling this function on it, like this.
DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position,
Sset_mouse_pixel_position, 3, 3, 0,
doc: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
+The position is given in pixels, where (0, 0) is the upper-left corner
+of the frame, X is the horizontal offset, and Y is the vertical offset.
+
Note, this is a no-op for an X frame that is not visible.
If you have just created a frame, you must wait for it to become visible
before calling this function on it, like this.
a surrogate minibuffer frame when a frame doesn't have its own
minibuffer window.
-A frame's focus redirection can be changed by select-frame. If frame
+A frame's focus redirection can be changed by `select-frame'. If frame
FOO is selected, and then a different frame BAR is selected, any
frames redirecting their focus to FOO are shifted to redirect their
focus to BAR. This allows focus redirection to work properly when the
This means that a frame whose focus is redirected to itself is treated
differently from a frame whose focus is redirected to nil; the former
-is affected by select-frame, while the latter is not.
+is affected by `select-frame', while the latter is not.
The redirection lasts until `redirect-frame-focus' is called to change it. */)
(frame, focus_frame)
/* Set the name of the terminal frame. Also used by MSDOS frames.
Modeled after x_set_name which is used for WINDOW frames. */
-void
+static void
set_term_frame_name (f, name)
struct frame *f;
Lisp_Object name;
0, 1, 0,
doc: /* Width in pixels of characters in the font in frame FRAME.
If FRAME is omitted, the selected frame is used.
-The width is the same for all characters, because
-currently Emacs supports only fixed-width fonts.
+On a graphical screen, the width is the standard width of the default font.
For a terminal screen, the value is always 1. */)
(frame)
Lisp_Object frame;
extern Lisp_Object Qtop;
/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
- wanted positions of the WM window (not emacs window).
+ wanted positions of the WM window (not Emacs window).
Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
window (FRAME_X_WINDOW).
*/
|| EQ (prop, Qfullscreen))
{
register Lisp_Object param_index, old_value;
+ int count = SPECPDL_INDEX ();
old_value = get_frame_param (f, prop);
fullscreen_is_being_set |= EQ (prop, Qfullscreen);
if (NILP (Fequal (val, old_value)))
{
+ /* For :font attributes, the frame_parm_handler
+ x_set_font calls `face-set-after-frame-default'.
+ Unless we bind inhibit-face-set-after-frame-default
+ here, this would reset the :font attribute that we
+ just applied to the default value for new faces. */
+ specbind (Qinhibit_face_set_after_frame_default, Qt);
+
store_frame_param (f, prop, val);
param_index = Fget (prop, Qx_frame_parameter);
< sizeof (frame_parms)/sizeof (frame_parms[0]))
&& rif->frame_parm_handlers[XINT (param_index)])
(*(rif->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
+
+ unbind_to (count, Qnil);
}
}
}
f->want_fullscreen = FULLSCREEN_WIDTH;
else if (EQ (new_value, Qfullheight))
f->want_fullscreen = FULLSCREEN_HEIGHT;
+
+ if (fullscreen_hook != NULL)
+ fullscreen_hook (f);
}
else if (NATNUMP (new_value))
f->extra_line_spacing = XFASTINT (new_value);
else
- Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"),
- Fcons (new_value, Qnil)));
+ signal_error ("Invalid line-spacing", new_value);
if (FRAME_VISIBLE_P (f))
redraw_frame (f);
}
/* The value 0.4545 is the normal viewing gamma. */
f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
else
- Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"),
- Fcons (new_value, Qnil)));
+ signal_error ("Invalid screen-gamma", new_value);
clear_face_cache (0);
}
else if (!NILP (Fequal (result, oldval)))
return;
+ /* Recalculate toolbar height. */
+ f->n_tool_bar_rows = 0;
+ /* Ensure we redraw it. */
+ clear_current_matrices (f);
+
store_frame_param (f, Qfont, result);
recompute_basic_faces (f);
}
if (XINT (arg) == f->border_width)
return;
-#ifndef MAC_OS
if (FRAME_X_WINDOW (f) != 0)
- error ("Cannot change the border width of a window");
-#endif /* MAC_TODO */
+ error ("Cannot change the border width of a frame");
f->border_width = XINT (arg);
}
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
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;
register Lisp_Object tem;
tem = Fassq (param, alist);
- if (EQ (tem, Qnil))
+
+ if (!NILP (tem))
+ {
+ /* If we find this parm in ALIST, clear it out
+ so that it won't be "left over" at the end. */
+#ifndef WINDOWSNT /* w32fns.c has not yet been changed to cope with this. */
+ Lisp_Object tail;
+ XSETCAR (tem, Qnil);
+ /* In case the parameter appears more than once in the alist,
+ clear it out. */
+ for (tail = alist; CONSP (tail); tail = XCDR (tail))
+ if (CONSP (XCAR (tail))
+ && EQ (XCAR (XCAR (tail)), param))
+ XSETCAR (XCAR (tail), Qnil);
+#endif
+ }
+ else
tem = Fassq (param, Vdefault_frame_alist);
+
+ /* If it wasn't specified in ALIST or the Lisp-level defaults,
+ look in the X resources. */
if (EQ (tem, Qnil))
{
if (attribute)
value = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, param,
attribute, class, type);
- if (! NILP (value))
+ if (! NILP (value) && ! EQ (value, Qunbound))
store_frame_param (f, param, value);
return value;
Qface_set_after_frame_default = intern ("face-set-after-frame-default");
staticpro (&Qface_set_after_frame_default);
+ Qinhibit_face_set_after_frame_default
+ = intern ("inhibit-face-set-after-frame-default");
+ staticpro (&Qinhibit_face_set_after_frame_default);
+
Qfullwidth = intern ("fullwidth");
staticpro (&Qfullwidth);
Qfullheight = intern ("fullheight");
doc: /* The initial frame-object, which represents Emacs's stdout. */);
DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified,
- doc: /* Non-nil if all of emacs is iconified and frame updates are not needed. */);
+ doc: /* Non-nil if all of Emacs is iconified and frame updates are not needed. */);
Vemacs_iconified = Qnil;
DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function,