/* Generic frame functions.
Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <stdio.h>
#include <ctype.h>
+#include <setjmp.h>
#include "lisp.h"
#include "character.h"
#ifdef HAVE_X_WINDOWS
#include "termhooks.h"
#include "dispextern.h"
#include "window.h"
-#ifdef HAVE_WINDOW_SYSTEM
#include "font.h"
+#ifdef HAVE_WINDOW_SYSTEM
#include "fontset.h"
#endif
#ifdef MSDOS
Lisp_Object Qexplicit_name;
Lisp_Object Qunsplittable;
Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
+Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
Lisp_Object Qleft_fringe, Qright_fringe;
Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list;
Lisp_Object Qtty_color_mode;
int focus_follows_mouse;
\f
static void
-set_menu_bar_lines_1 (window, n)
- Lisp_Object window;
- int n;
+set_menu_bar_lines_1 (Lisp_Object window, int n)
{
struct window *w = XWINDOW (window);
}
void
-set_menu_bar_lines (f, value, oldval)
- struct frame *f;
- Lisp_Object value, oldval;
+set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
int nlines;
int olines = FRAME_MENU_BAR_LINES (f);
Lisp_Object Vframe_list;
extern Lisp_Object Vminibuffer_list;
-extern Lisp_Object get_minibuffer ();
-extern Lisp_Object Fhandle_switch_frame ();
-extern Lisp_Object Fredirect_frame_focus ();
+extern Lisp_Object get_minibuffer (int);
+extern Lisp_Object Fhandle_switch_frame (Lisp_Object event);
+extern Lisp_Object Fredirect_frame_focus (Lisp_Object frame, Lisp_Object focus_frame);
extern Lisp_Object x_get_focus_frame ();
+extern Lisp_Object QCname, Qfont_param;
+
\f
DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
doc: /* Return non-nil if OBJECT is a frame.
}
struct frame *
-make_frame (mini_p)
- int mini_p;
+make_frame (int mini_p)
{
Lisp_Object frame;
register struct frame *f;
default (the global minibuffer). */
struct frame *
-make_frame_without_minibuffer (mini_window, kb, display)
- register Lisp_Object mini_window;
- KBOARD *kb;
- Lisp_Object display;
+make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lisp_Object display)
{
register struct frame *f;
struct gcpro gcpro1;
/* Make a frame containing only a minibuffer window. */
struct frame *
-make_minibuffer_frame ()
+make_minibuffer_frame (void)
{
/* First make a frame containing just a root window, no minibuffer. */
Vframe_list = Fcons (frame, Vframe_list);
tty_frame_count = 1;
- f->name = build_string ("F1");
+ f->name = make_pure_c_string ("F1");
f->visible = 1;
f->async_visible = 1;
/* Get a suitable value for frame parameter PARAMETER for a newly
created frame, based on (1) the user-supplied frame parameter
- alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
- fails, (3) Vdefault_frame_alist. */
+ alist SUPPLIED_PARMS, and (2) CURRENT_VALUE. */
static Lisp_Object
get_future_frame_param (Lisp_Object parameter,
result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
if (NILP (result) && current_value != NULL)
result = build_string (current_value);
- if (NILP (result))
- result = Fassq (parameter, Vdefault_frame_alist);
if (!NILP (result) && !STRINGP (result))
result = XCDR (result);
if (NILP (result) || !STRINGP (result))
adjust_glyphs (f);
calculate_costs (f);
XSETFRAME (frame, f);
- Fmodify_frame_parameters (frame, Vdefault_frame_alist);
Fmodify_frame_parameters (frame, parms);
Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
build_string (t->display_info.tty->type)),
The value of NORECORD is passed as argument to Fselect_window. */
Lisp_Object
-do_switch_frame (frame, track, for_deletion, norecord)
- Lisp_Object frame, norecord;
- int track, for_deletion;
+do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object norecord)
{
struct frame *sf = SELECTED_FRAME ();
something to select a different frame, or until the next time
this function is called. If you are using a window system, the
previously selected frame may be restored as the selected frame
-after return to 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.
+when returning to 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, norecord)
Otherwise, include all frames. */
static Lisp_Object
-next_frame (frame, minibuf)
- Lisp_Object frame;
- Lisp_Object minibuf;
+next_frame (Lisp_Object frame, Lisp_Object minibuf)
{
Lisp_Object tail;
int passed = 0;
Otherwise, include all frames. */
static Lisp_Object
-prev_frame (frame, minibuf)
- Lisp_Object frame;
- Lisp_Object minibuf;
+prev_frame (Lisp_Object frame, Lisp_Object minibuf)
{
Lisp_Object tail;
Lisp_Object prev;
(Exception: if F is the terminal frame, and we are using X, return 1.) */
int
-other_visible_frames (f)
- FRAME_PTR f;
+other_visible_frames (FRAME_PTR f)
{
/* We know the selected frame is visible,
so if F is some other frame, it can't be the sole visible one. */
this. Any other value of FORCE implements the semantics
described for Fdelete_frame. */
Lisp_Object
-delete_frame (frame, force)
+delete_frame (Lisp_Object frame, Lisp_Object force)
/* If we use `register' here, gcc-4.0.2 on amd64 using
-DUSE_LISP_UNION_TYPE complains further down that we're getting the
address of `force'. Go figure. */
- Lisp_Object frame, force;
+
{
struct frame *f;
struct frame *sf = SELECTED_FRAME ();
return Qnil;
}
\f
-static void make_frame_visible_1 P_ ((Lisp_Object));
+static void make_frame_visible_1 (Lisp_Object);
DEFUN ("make-frame-visible", Fmake_frame_visible, Smake_frame_visible,
0, 1, "",
and all its descendents. */
static void
-make_frame_visible_1 (window)
- Lisp_Object window;
+make_frame_visible_1 (Lisp_Object window)
{
struct window *w;
DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible,
0, 2, "",
- doc: /* Make the frame FRAME invisible (assuming it is an X window).
+ doc: /* Make the frame FRAME invisible.
If omitted, FRAME defaults to the currently selected frame.
+On graphical displays, invisible frames are not updated and are
+usually not displayed at all, even in a window system's \"taskbar\".
+
Normally you may not make FRAME invisible if all other frames are invisible,
-but if the second optional argument FORCE is non-nil, you may do so. */)
+but if the second optional argument FORCE is non-nil, you may do so.
+
+This function has no effect on text-only terminal frames. Such frames
+are always considered visible, whether or not they are currently being
+displayed in the terminal. */)
(frame, force)
Lisp_Object frame, force;
{
DEFUN ("frame-visible-p", Fframe_visible_p, Sframe_visible_p,
1, 1, 0,
- doc: /* Return t if FRAME is now \"visible\" (actually in use for display).
-A frame that is not \"visible\" is not updated and, if it works through
-a window system, it may not show at all.
-Return the symbol `icon' if frame is visible only as an icon.
-
-On a text-only terminal, all frames are considered visible, whether
-they are currently being displayed or not, and this function returns t
-for all frames. */)
+ doc: /* Return t if FRAME is \"visible\" (actually in use for display).
+Return the symbol `icon' if FRAME is iconified or \"minimized\".
+Return nil if FRAME was made invisible, via `make-frame-invisible'.
+On graphical displays, invisible frames are not updated and are
+usually not displayed at all, even in a window system's \"taskbar\".
+
+If FRAME is a text-only terminal frame, this always returns t.
+Such frames are always considered visible, whether or not they are
+currently being displayed on the terminal. */)
(frame)
Lisp_Object frame;
{
/* Return the value of frame parameter PROP in frame FRAME. */
Lisp_Object
-get_frame_param (frame, prop)
- register struct frame *frame;
- Lisp_Object prop;
+get_frame_param (register struct frame *frame, Lisp_Object prop)
{
register Lisp_Object tem;
/* Return the buffer-predicate of the selected frame. */
Lisp_Object
-frame_buffer_predicate (frame)
- Lisp_Object frame;
+frame_buffer_predicate (Lisp_Object frame)
{
return XFRAME (frame)->buffer_predicate;
}
/* Return the buffer-list of the selected frame. */
Lisp_Object
-frame_buffer_list (frame)
- Lisp_Object frame;
+frame_buffer_list (Lisp_Object frame)
{
return XFRAME (frame)->buffer_list;
}
/* Set the buffer-list of the selected frame. */
void
-set_frame_buffer_list (frame, list)
- Lisp_Object frame, list;
+set_frame_buffer_list (Lisp_Object frame, Lisp_Object list)
{
XFRAME (frame)->buffer_list = list;
}
/* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
void
-frames_discard_buffer (buffer)
- Lisp_Object buffer;
+frames_discard_buffer (Lisp_Object buffer)
{
Lisp_Object frame, tail;
If the alist already has an element for PROP, we change it. */
void
-store_in_alist (alistptr, prop, val)
- Lisp_Object *alistptr, val;
- Lisp_Object prop;
+store_in_alist (Lisp_Object *alistptr, Lisp_Object prop, Lisp_Object val)
{
register Lisp_Object tem;
}
static int
-frame_name_fnn_p (str, len)
- char *str;
- EMACS_INT len;
+frame_name_fnn_p (char *str, EMACS_INT len)
{
if (len > 1 && str[0] == 'F')
{
Modeled after x_set_name which is used for WINDOW frames. */
static void
-set_term_frame_name (f, name)
- struct frame *f;
- Lisp_Object name;
+set_term_frame_name (struct frame *f, Lisp_Object name)
{
f->explicit_name = ! NILP (name);
}
void
-store_frame_param (f, prop, val)
- struct frame *f;
- Lisp_Object prop, val;
+store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
{
register Lisp_Object old_alist_elt;
without messing up the symbol's status. */
if (SYMBOLP (prop))
{
- Lisp_Object valcontents;
- valcontents = SYMBOL_VALUE (prop);
- if ((BUFFER_LOCAL_VALUEP (valcontents))
- && XBUFFER_LOCAL_VALUE (valcontents)->check_frame
- && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame
- && XFRAME (XBUFFER_LOCAL_VALUE (valcontents)->frame) == f)
- swap_in_global_binding (prop);
+ struct Lisp_Symbol *sym = XSYMBOL (prop);
+ start:
+ switch (sym->redirect)
+ {
+ case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
+ case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break;
+ case SYMBOL_LOCALIZED:
+ { struct Lisp_Buffer_Local_Value *blv = sym->val.blv;
+ if (blv->frame_local && BLV_FOUND (blv) && XFRAME (blv->where) == f)
+ swap_in_global_binding (sym);
+ break;
+ }
+ default: abort ();
+ }
}
/* The tty color needed to be set before the frame's parameter
|| EQ (parameter, Qbackground_mode))
value = Fcdr (Fassq (parameter, f->param_alist));
else
+ /* FIXME: Avoid this code path at all (as well as code duplication)
+ by sharing more code with Fframe_parameters. */
value = Fcdr (Fassq (parameter, Fframe_parameters (frame)));
}
DEFUN ("frame-pixel-height", Fframe_pixel_height,
Sframe_pixel_height, 0, 1, 0,
doc: /* Return a FRAME's height in pixels.
-This counts only the height available for text lines,
-not menu bars on window-system Emacs frames.
-For a terminal frame, the result really gives the height in characters.
-If FRAME is omitted, the selected frame is used. */)
+If FRAME is omitted, the selected frame is used. The exact value
+of the result depends on the window-system and toolkit in use:
+
+In the Gtk+ version of Emacs, it includes only any window (including
+the minibuffer or eacho area), mode line, and header line. It does not
+include the tool bar or menu bar.
+
+With the Motif or Lucid toolkits, it also includes the tool bar (but
+not the menu bar).
+
+In a graphical version with no toolkit, it includes both the tool bar
+and menu bar.
+
+For a text-only terminal, it includes the menu bar. In this case, the
+result is really in characters rather than pixels (i.e., is identical
+to `frame-height'). */)
(frame)
Lisp_Object frame;
{
*/
void
-x_fullscreen_adjust (f, width, height, top_pos, left_pos)
- struct frame *f;
- int *width;
- int *height;
- int *top_pos;
- int *left_pos;
+x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int *left_pos)
{
int newwidth = FRAME_COLS (f);
int newheight = FRAME_LINES (f);
to store the new value in the parameter alist. */
void
-x_set_frame_parameters (f, alist)
- FRAME_PTR f;
- Lisp_Object alist;
+x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
{
Lisp_Object tail;
param_alist need to be considered here. */
void
-x_report_frame_params (f, alistptr)
- struct frame *f;
- Lisp_Object *alistptr;
+x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
{
char buf[16];
Lisp_Object tem;
the previous value of that parameter, NEW_VALUE is the new value. */
void
-x_set_fullscreen (f, new_value, old_value)
- struct frame *f;
- Lisp_Object new_value, old_value;
+x_set_fullscreen (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
{
if (NILP (new_value))
f->want_fullscreen = FULLSCREEN_NONE;
the previous value of that parameter, NEW_VALUE is the new value. */
void
-x_set_line_spacing (f, new_value, old_value)
- struct frame *f;
- Lisp_Object new_value, old_value;
+x_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
{
if (NILP (new_value))
f->extra_line_spacing = 0;
the previous value of that parameter, NEW_VALUE is the new value. */
void
-x_set_screen_gamma (f, new_value, old_value)
- struct frame *f;
- Lisp_Object new_value, old_value;
+x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
{
Lisp_Object bgcolor;
void
-x_set_font (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
- Lisp_Object frame, font_object, lval;
+ Lisp_Object frame, font_object, font_param = Qnil;
int fontset = -1;
/* Set the frame parameter back to the old value because we may
never fail. */
if (STRINGP (arg))
{
+ font_param = arg;
fontset = fs_query_fontset (arg, 0);
if (fontset < 0)
{
error ("Unknown fontset: %s", SDATA (XCAR (arg)));
font_object = XCDR (arg);
arg = AREF (font_object, FONT_NAME_INDEX);
+ font_param = Ffont_get (font_object, QCname);
}
else if (FONT_OBJECT_P (arg))
{
font_object = arg;
+ font_param = Ffont_get (font_object, QCname);
/* This is to store the XLFD font name in the frame parameter for
- backward compatiblity. We should store the font-object
+ backward compatibility. We should store the font-object
itself in the future. */
arg = AREF (font_object, FONT_NAME_INDEX);
fontset = FRAME_FONTSET (f);
if (! NILP (Fequal (font_object, oldval)))
return;
-
- lval = Fassq (Qfullscreen, f->param_alist);
- if (CONSP (lval)) lval = CDR (lval);
-
x_new_font (f, font_object, fontset);
store_frame_param (f, Qfont, arg);
+#ifdef HAVE_X_WINDOWS
+ store_frame_param (f, Qfont_param, font_param);
+#endif
/* Recalculate toolbar height. */
f->n_tool_bar_rows = 0;
/* Ensure we redraw it. */
void
-x_set_font_backend (f, new_value, old_value)
- struct frame *f;
- Lisp_Object new_value, old_value;
+x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
{
if (! NILP (new_value)
&& !CONSP (new_value))
void
-x_set_fringe_width (f, new_value, old_value)
- struct frame *f;
- Lisp_Object new_value, old_value;
+x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
{
compute_fringe_widths (f, 1);
}
void
-x_set_border_width (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
CHECK_NUMBER (arg);
}
void
-x_set_internal_border_width (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int old = FRAME_INTERNAL_BORDER_WIDTH (f);
}
void
-x_set_visibility (f, value, oldval)
- struct frame *f;
- Lisp_Object value, oldval;
+x_set_visibility (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
Lisp_Object frame;
XSETFRAME (frame, f);
}
void
-x_set_autoraise (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_autoraise (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
f->auto_raise = !EQ (Qnil, arg);
}
void
-x_set_autolower (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_autolower (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
f->auto_lower = !EQ (Qnil, arg);
}
void
-x_set_unsplittable (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_unsplittable (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
f->no_split = !NILP (arg);
}
void
-x_set_vertical_scroll_bars (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
|| (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))
}
void
-x_set_scroll_bar_width (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int wid = FRAME_COLUMN_WIDTH (f);
/* Return non-nil if frame F wants a bitmap icon. */
Lisp_Object
-x_icon_type (f)
- FRAME_PTR f;
+x_icon_type (FRAME_PTR f)
{
Lisp_Object tem;
}
void
-x_set_alpha (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
double alpha = 1.0;
double newval[2];
Fix it up, or set it to `emacs' if it is too hopeless. */
void
-validate_x_resource_name ()
+validate_x_resource_name (void)
{
int len = 0;
/* Number of valid characters in the resource name. */
}
-extern char *x_get_string_resource P_ ((XrmDatabase, char *, char *));
-extern Display_Info *check_x_display_info P_ ((Lisp_Object));
+extern char *x_get_string_resource (XrmDatabase, char *, char *);
+extern Display_Info *check_x_display_info (Lisp_Object);
/* Get specified attribute from resource database RDB.
See Fx_get_resource below for other parameters. */
static Lisp_Object
-xrdb_get_resource (rdb, attribute, class, component, subclass)
- XrmDatabase rdb;
- Lisp_Object attribute, class, component, subclass;
+xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass)
{
register char *value;
char *name_key;
value = x_get_string_resource (rdb, name_key, class_key);
- if (value != (char *) 0)
+ if (value != (char *) 0 && *value)
return build_string (value);
else
return Qnil;
/* Get an X resource, like Fx_get_resource, but for display DPYINFO. */
Lisp_Object
-display_x_get_resource (dpyinfo, attribute, class, component, subclass)
- Display_Info *dpyinfo;
- Lisp_Object attribute, class, component, subclass;
+display_x_get_resource (Display_Info *dpyinfo, Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass)
{
return xrdb_get_resource (dpyinfo->xrdb,
attribute, class, component, subclass);
}
+#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
/* Used when C code wants a resource value. */
-
+/* Called from oldXMenu/Create.c. */
char *
-x_get_resource_string (attribute, class)
- char *attribute, *class;
+x_get_resource_string (char *attribute, char *class)
{
char *name_key;
char *class_key;
return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb,
name_key, class_key);
}
-
+#endif
/* Return the value of parameter PARAM.
and don't let it get stored in any Lisp-visible variables! */
Lisp_Object
-x_get_arg (dpyinfo, alist, param, attribute, class, type)
- Display_Info *dpyinfo;
- Lisp_Object alist, param;
- char *attribute;
- char *class;
- enum resource_types type;
+x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
{
register Lisp_Object tem;
case RES_TYPE_NUMBER:
return make_number (atoi (SDATA (tem)));
+ case RES_TYPE_BOOLEAN_NUMBER:
+ if (!strcmp (SDATA (tem), "on")
+ || !strcmp (SDATA (tem), "true"))
+ return make_number (1);
+ return make_number (atoi (SDATA (tem)));
+ break;
+
case RES_TYPE_FLOAT:
return make_float (atof (SDATA (tem)));
}
Lisp_Object
-x_frame_get_arg (f, alist, param, attribute, class, type)
- struct frame *f;
- Lisp_Object alist, param;
- char *attribute;
- char *class;
- enum resource_types type;
+x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
{
return x_get_arg (FRAME_X_DISPLAY_INFO (f),
alist, param, attribute, class, type);
/* Like x_frame_get_arg, but also record the value in f->param_alist. */
Lisp_Object
-x_frame_get_and_record_arg (f, alist, param, attribute, class, type)
- struct frame *f;
- Lisp_Object alist, param;
- char *attribute;
- char *class;
- enum resource_types type;
+x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
{
Lisp_Object value;
If that is not found either, use the value DEFLT. */
Lisp_Object
-x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
- struct frame *f;
- Lisp_Object alist;
- Lisp_Object prop;
- Lisp_Object deflt;
- char *xprop;
- char *xclass;
- enum resource_types type;
+x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop, Lisp_Object deflt, char *xprop, char *xclass, enum resource_types type)
{
Lisp_Object tem;
\f
-#ifdef HAVE_NS
-
-/* We used to define x-parse-geometry directly in ns-win.el, but that
- confused make-docfile: the documentation string in ns-win.el was
- used for x-parse-geometry even in non-NS builds.. */
-
-DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
- doc: /* Parse a Nextstep-style geometry string STRING.
-Returns an alist of the form ((top . TOP), (left . LEFT) ... ).
-The properties returned may include `top', `left', `height', and `width'.
-This works by calling `ns-parse-geometry'. */)
- (string)
- Lisp_Object string;
-{
- call1 (Qns_parse_geometry, string);
-}
-
-#else /* !HAVE_NS */
-
+/* NS used to define x-parse-geometry in ns-win.el, but that confused
+ make-docfile: the documentation string in ns-win.el was used for
+ x-parse-geometry even in non-NS builds.
+
+ With two definitions of x-parse-geometry in this file, various
+ things still get confused (eg M-x apropos documentation), so that
+ it is best if the two definitions just share the same doc-string.
+*/
DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
- doc: /* Parse an X-style geometry string STRING.
+ doc: /* Parse a display geometry string STRING.
Returns an alist of the form ((top . TOP), (left . LEFT) ... ).
The properties returned may include `top', `left', `height', and `width'.
-The value of `left' or `top' may be an integer,
+For X, the value of `left' or `top' may be an integer,
or a list (+ N) meaning N pixels relative to top/left corner,
-or a list (- N) meaning -N pixels relative to bottom/right corner. */)
+or a list (- N) meaning -N pixels relative to bottom/right corner.
+On Nextstep, this just calls `ns-parse-geometry'. */)
(string)
Lisp_Object string;
{
+#ifdef HAVE_NS
+ call1 (Qns_parse_geometry, string);
+#else
int geometry, x, y;
unsigned int width, height;
Lisp_Object result;
result = Fcons (Fcons (Qheight, make_number (height)), result);
return result;
-}
#endif /* HAVE_NS */
+}
/* Calculate the desired size and position of frame F.
This function does not make the coordinates positive. */
-#define DEFAULT_ROWS 40
+#define DEFAULT_ROWS 35
#define DEFAULT_COLS 80
int
-x_figure_window_size (f, parms, toolbar_p)
- struct frame *f;
- Lisp_Object parms;
- int toolbar_p;
+x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p)
{
register Lisp_Object tem0, tem1, tem2;
long window_prompting = 0;
#endif /* HAVE_WINDOW_SYSTEM */
void
-frame_make_pointer_invisible ()
+frame_make_pointer_invisible (void)
{
if (! NILP (Vmake_pointer_invisible))
{
- struct frame *f = SELECTED_FRAME ();
+ struct frame *f;
+ if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame)))
+ return;
+
+ f = SELECTED_FRAME ();
if (f && !f->pointer_invisible
&& FRAME_TERMINAL (f)->toggle_invisible_pointer_hook)
{
}
void
-frame_make_pointer_visible ()
+frame_make_pointer_visible (void)
{
/* We don't check Vmake_pointer_invisible here in case the
pointer was invisible when Vmake_pointer_invisible was set to nil. */
+ struct frame *f;
+
+ if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame)))
+ return;
- struct frame *f = SELECTED_FRAME ();
+ f = SELECTED_FRAME ();
if (f && f->pointer_invisible && f->mouse_moved
&& FRAME_TERMINAL (f)->toggle_invisible_pointer_hook)
{
***********************************************************************/
void
-syms_of_frame ()
+syms_of_frame (void)
{
- Qframep = intern ("framep");
+ Qframep = intern_c_string ("framep");
staticpro (&Qframep);
- Qframe_live_p = intern ("frame-live-p");
+ Qframe_live_p = intern_c_string ("frame-live-p");
staticpro (&Qframe_live_p);
- Qexplicit_name = intern ("explicit-name");
+ Qexplicit_name = intern_c_string ("explicit-name");
staticpro (&Qexplicit_name);
- Qheight = intern ("height");
+ Qheight = intern_c_string ("height");
staticpro (&Qheight);
- Qicon = intern ("icon");
+ Qicon = intern_c_string ("icon");
staticpro (&Qicon);
- Qminibuffer = intern ("minibuffer");
+ Qminibuffer = intern_c_string ("minibuffer");
staticpro (&Qminibuffer);
- Qmodeline = intern ("modeline");
+ Qmodeline = intern_c_string ("modeline");
staticpro (&Qmodeline);
- Qonly = intern ("only");
+ Qonly = intern_c_string ("only");
staticpro (&Qonly);
- Qwidth = intern ("width");
+ Qwidth = intern_c_string ("width");
staticpro (&Qwidth);
- Qgeometry = intern ("geometry");
+ Qgeometry = intern_c_string ("geometry");
staticpro (&Qgeometry);
- Qicon_left = intern ("icon-left");
+ Qicon_left = intern_c_string ("icon-left");
staticpro (&Qicon_left);
- Qicon_top = intern ("icon-top");
+ Qicon_top = intern_c_string ("icon-top");
staticpro (&Qicon_top);
- Qleft = intern ("left");
+ Qleft = intern_c_string ("left");
staticpro (&Qleft);
- Qright = intern ("right");
+ Qright = intern_c_string ("right");
staticpro (&Qright);
- Quser_position = intern ("user-position");
+ Quser_position = intern_c_string ("user-position");
staticpro (&Quser_position);
- Quser_size = intern ("user-size");
+ Quser_size = intern_c_string ("user-size");
staticpro (&Quser_size);
- Qwindow_id = intern ("window-id");
+ Qwindow_id = intern_c_string ("window-id");
staticpro (&Qwindow_id);
#ifdef HAVE_X_WINDOWS
- Qouter_window_id = intern ("outer-window-id");
+ Qouter_window_id = intern_c_string ("outer-window-id");
staticpro (&Qouter_window_id);
#endif
- Qparent_id = intern ("parent-id");
+ Qparent_id = intern_c_string ("parent-id");
staticpro (&Qparent_id);
- Qx = intern ("x");
+ Qx = intern_c_string ("x");
staticpro (&Qx);
- Qw32 = intern ("w32");
+ Qw32 = intern_c_string ("w32");
staticpro (&Qw32);
- Qpc = intern ("pc");
+ Qpc = intern_c_string ("pc");
staticpro (&Qpc);
- Qmac = intern ("mac");
+ Qmac = intern_c_string ("mac");
staticpro (&Qmac);
- Qns = intern ("ns");
+ Qns = intern_c_string ("ns");
staticpro (&Qns);
- Qvisible = intern ("visible");
+ Qvisible = intern_c_string ("visible");
staticpro (&Qvisible);
- Qbuffer_predicate = intern ("buffer-predicate");
+ Qbuffer_predicate = intern_c_string ("buffer-predicate");
staticpro (&Qbuffer_predicate);
- Qbuffer_list = intern ("buffer-list");
+ Qbuffer_list = intern_c_string ("buffer-list");
staticpro (&Qbuffer_list);
- Qburied_buffer_list = intern ("buried-buffer-list");
+ Qburied_buffer_list = intern_c_string ("buried-buffer-list");
staticpro (&Qburied_buffer_list);
- Qdisplay_type = intern ("display-type");
+ Qdisplay_type = intern_c_string ("display-type");
staticpro (&Qdisplay_type);
- Qbackground_mode = intern ("background-mode");
+ Qbackground_mode = intern_c_string ("background-mode");
staticpro (&Qbackground_mode);
- Qnoelisp = intern ("noelisp");
+ Qnoelisp = intern_c_string ("noelisp");
staticpro (&Qnoelisp);
- Qtty_color_mode = intern ("tty-color-mode");
+ Qtty_color_mode = intern_c_string ("tty-color-mode");
staticpro (&Qtty_color_mode);
- Qtty = intern ("tty");
+ Qtty = intern_c_string ("tty");
staticpro (&Qtty);
- Qtty_type = intern ("tty-type");
+ Qtty_type = intern_c_string ("tty-type");
staticpro (&Qtty_type);
- Qface_set_after_frame_default = intern ("face-set-after-frame-default");
+ Qface_set_after_frame_default = intern_c_string ("face-set-after-frame-default");
staticpro (&Qface_set_after_frame_default);
- Qfullwidth = intern ("fullwidth");
+ Qfullwidth = intern_c_string ("fullwidth");
staticpro (&Qfullwidth);
- Qfullheight = intern ("fullheight");
+ Qfullheight = intern_c_string ("fullheight");
staticpro (&Qfullheight);
- Qfullboth = intern ("fullboth");
+ Qfullboth = intern_c_string ("fullboth");
staticpro (&Qfullboth);
- Qmaximized = intern ("maximized");
+ Qmaximized = intern_c_string ("maximized");
staticpro (&Qmaximized);
- Qx_resource_name = intern ("x-resource-name");
+ Qx_resource_name = intern_c_string ("x-resource-name");
staticpro (&Qx_resource_name);
- Qx_frame_parameter = intern ("x-frame-parameter");
+ Qx_frame_parameter = intern_c_string ("x-frame-parameter");
staticpro (&Qx_frame_parameter);
- Qterminal = intern ("terminal");
+ Qterminal = intern_c_string ("terminal");
staticpro (&Qterminal);
- Qterminal_live_p = intern ("terminal-live-p");
+ Qterminal_live_p = intern_c_string ("terminal-live-p");
staticpro (&Qterminal_live_p);
#ifdef HAVE_NS
- Qns_parse_geometry = intern ("ns-parse-geometry");
+ Qns_parse_geometry = intern_c_string ("ns-parse-geometry");
staticpro (&Qns_parse_geometry);
#endif
for (i = 0; i < sizeof (frame_parms) / sizeof (frame_parms[0]); i++)
{
- Lisp_Object v = intern (frame_parms[i].name);
+ Lisp_Object v = intern_c_string (frame_parms[i].name);
if (frame_parms[i].variable)
{
*frame_parms[i].variable = v;
DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars,
doc: /* Default position of scroll bars on this window-system. */);
#ifdef HAVE_WINDOW_SYSTEM
-#if defined(HAVE_NTGUI) || defined(NS_IMPL_COCOA)
- /* MS-Windows and Mac OS X have scroll bars on the right by default. */
+#if defined(HAVE_NTGUI) || defined(NS_IMPL_COCOA) || (defined(USE_GTK) && defined(USE_TOOLKIT_SCROLL_BARS))
+ /* MS-Windows, Mac OS X, and GTK have scroll bars on the right by
+ default. */
Vdefault_frame_scroll_bars = Qright;
#else
Vdefault_frame_scroll_bars = Qleft;
in `delete-frame-functions' (indirectly) calls `delete-frame'
recursively). */);
Vdelete_frame_functions = Qnil;
- Qdelete_frame_functions = intern ("delete-frame-functions");
+ Qdelete_frame_functions = intern_c_string ("delete-frame-functions");
staticpro (&Qdelete_frame_functions);
+ DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode,
+ doc: /* Non-nil if Menu-Bar mode is enabled. */);
+ Vmenu_bar_mode = Qt;
+
+ DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode,
+ doc: /* Non-nil if Tool-Bar mode is enabled. */);
+ Vtool_bar_mode = Qt;
+
DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
doc: /* Minibufferless frames use this frame's minibuffer.
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. */);
+automatically. See also `mouse-autoselect-window'. */);
#ifdef HAVE_WINDOW_SYSTEM
#if defined(HAVE_NTGUI) || defined(HAVE_NS)
focus_follows_mouse = 0;