{
struct window *w = XWINDOW (window);
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->top_line, XFASTINT (w->top_line) + n);
- XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - n);
+ w->last_modified = 0;
+ XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (w, top_line)) + n);
+ XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - n);
/* Handle just the top child in a vertical split. */
- if (!NILP (w->vchild))
- set_menu_bar_lines_1 (w->vchild, n);
+ if (!NILP (WVAR (w, vchild)))
+ set_menu_bar_lines_1 (WVAR (w, vchild), n);
/* Adjust all children in a horizontal split. */
- for (window = w->hchild; !NILP (window); window = w->next)
+ for (window = WVAR (w, hchild); !NILP (window); window = WVAR (w, next))
{
w = XWINDOW (window);
set_menu_bar_lines_1 (window, n);
windows_or_buffers_changed++;
FRAME_WINDOW_SIZES_CHANGED (f) = 1;
FRAME_MENU_BAR_LINES (f) = nlines;
- set_menu_bar_lines_1 (f->root_window, nlines - olines);
+ set_menu_bar_lines_1 (FVAR (f, root_window), nlines - olines);
adjust_glyphs (f);
}
}
f = allocate_frame ();
XSETFRAME (frame, f);
- f->desired_matrix = 0;
- f->current_matrix = 0;
- f->desired_pool = 0;
- f->current_pool = 0;
- f->glyphs_initialized_p = 0;
- f->decode_mode_spec_buffer = 0;
- f->visible = 0;
- f->async_visible = 0;
- f->output_data.nothing = 0;
- f->iconified = 0;
- f->async_iconified = 0;
+ /* Initialize Lisp data. Note that allocate_frame initializes all
+ Lisp data to nil, so do it only for slots which should not be nil. */
+ FVAR (f, tool_bar_position) = Qtop;
+
+ /* Initialize non-Lisp data. Note that allocate_frame zeroes out all
+ non-Lisp data, so do it only for slots which should not be zero.
+ To avoid subtle bugs and for the sake of readability, it's better to
+ initialize enum members explicitly even if their values are zero. */
f->wants_modeline = 1;
- f->auto_raise = 0;
- f->auto_lower = 0;
- f->no_split = 0;
f->garbaged = 1;
f->has_minibuffer = mini_p;
- f->focus_frame = Qnil;
- f->explicit_name = 0;
- f->can_have_scroll_bars = 0;
f->vertical_scroll_bar_type = vertical_scroll_bar_none;
- f->param_alist = Qnil;
- f->scroll_bars = Qnil;
- f->condemned_scroll_bars = Qnil;
- f->face_alist = Qnil;
- f->face_cache = NULL;
- f->menu_bar_items = Qnil;
- f->menu_bar_vector = Qnil;
- f->menu_bar_items_used = 0;
- f->buffer_predicate = Qnil;
- f->buffer_list = Qnil;
- f->buried_buffer_list = Qnil;
- f->namebuf = 0;
- f->title = Qnil;
- f->menu_bar_window = Qnil;
- f->tool_bar_window = Qnil;
- f->tool_bar_items = Qnil;
- f->tool_bar_position = Qtop;
- f->desired_tool_bar_string = f->current_tool_bar_string = Qnil;
- f->n_tool_bar_items = 0;
- f->left_fringe_width = f->right_fringe_width = 0;
- f->fringe_cols = 0;
- f->menu_bar_lines = 0;
- f->tool_bar_lines = 0;
- f->scroll_bar_actual_width = 0;
- f->border_width = 0;
- f->internal_border_width = 0;
f->column_width = 1; /* !FRAME_WINDOW_P value */
f->line_height = 1; /* !FRAME_WINDOW_P value */
- f->x_pixels_diff = f->y_pixels_diff = 0;
#ifdef HAVE_WINDOW_SYSTEM
f->want_fullscreen = FULLSCREEN_NONE;
#endif
- f->size_hint_flags = 0;
- f->win_gravity = 0;
- f->font_driver_list = NULL;
- f->font_data_list = NULL;
root_window = make_window ();
if (mini_p)
{
mini_window = make_window ();
- XWINDOW (root_window)->next = mini_window;
- XWINDOW (mini_window)->prev = root_window;
- XWINDOW (mini_window)->mini_p = Qt;
- XWINDOW (mini_window)->frame = frame;
- f->minibuffer_window = mini_window;
+ WVAR (XWINDOW (root_window), next) = mini_window;
+ WVAR (XWINDOW (mini_window), prev) = root_window;
+ XWINDOW (mini_window)->mini = 1;
+ WVAR (XWINDOW (mini_window), frame) = frame;
+ FVAR (f, minibuffer_window) = mini_window;
}
else
{
mini_window = Qnil;
- XWINDOW (root_window)->next = Qnil;
- f->minibuffer_window = Qnil;
+ WVAR (XWINDOW (root_window), next) = Qnil;
+ FVAR (f, minibuffer_window) = Qnil;
}
- XWINDOW (root_window)->frame = frame;
+ WVAR (XWINDOW (root_window), frame) = frame;
/* 10 is arbitrary,
just so that there is "something there."
SET_FRAME_COLS (f, 10);
FRAME_LINES (f) = 10;
- XSETFASTINT (XWINDOW (root_window)->total_cols, 10);
- XSETFASTINT (XWINDOW (root_window)->total_lines, (mini_p ? 9 : 10));
+ XSETFASTINT (WVAR (XWINDOW (root_window), total_cols), 10);
+ XSETFASTINT (WVAR (XWINDOW (root_window), total_lines), (mini_p ? 9 : 10));
if (mini_p)
{
- XSETFASTINT (XWINDOW (mini_window)->total_cols, 10);
- XSETFASTINT (XWINDOW (mini_window)->top_line, 9);
- XSETFASTINT (XWINDOW (mini_window)->total_lines, 1);
+ XSETFASTINT (WVAR (XWINDOW (mini_window), total_cols), 10);
+ XSETFASTINT (WVAR (XWINDOW (mini_window), top_line), 9);
+ XSETFASTINT (WVAR (XWINDOW (mini_window), total_lines), 1);
}
/* Choose a buffer for the frame's root window. */
{
Lisp_Object buf;
- XWINDOW (root_window)->buffer = Qt;
+ WVAR (XWINDOW (root_window), buffer) = Qt;
buf = Fcurrent_buffer ();
/* If buf is a 'hidden' buffer (i.e. one whose name starts with
a space), try to find another one. */
etc. Running Lisp functions at this point surely ends in a
SEGV. */
set_window_buffer (root_window, buf, 0, 0);
- f->buffer_list = Fcons (buf, Qnil);
+ FVAR (f, buffer_list) = Fcons (buf, Qnil);
}
if (mini_p)
{
- XWINDOW (mini_window)->buffer = Qt;
+ WVAR (XWINDOW (mini_window), buffer) = Qt;
set_window_buffer (mini_window,
(NILP (Vminibuffer_list)
? get_minibuffer (0)
0, 0);
}
- f->root_window = root_window;
- f->selected_window = root_window;
+ FVAR (f, root_window) = root_window;
+ FVAR (f, selected_window) = root_window;
/* Make sure this window seems more recently used than
a newly-created, never-selected window. */
- ++window_select_count;
- XSETFASTINT (XWINDOW (f->selected_window)->use_time, window_select_count);
-
- f->default_face_done_p = 0;
+ XWINDOW (FVAR (f, selected_window))->use_time = ++window_select_count;
return f;
}
CHECK_LIVE_WINDOW (mini_window);
if (!NILP (mini_window)
- && FRAME_KBOARD (XFRAME (XWINDOW (mini_window)->frame)) != kb)
+ && FRAME_KBOARD (XFRAME (WVAR (XWINDOW (mini_window), frame))) != kb)
error ("Frame and minibuffer must be on the same terminal");
/* Make a frame containing just a root window. */
UNGCPRO;
}
- mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window;
+ mini_window = FVAR (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)),
+ minibuffer_window);
}
- f->minibuffer_window = mini_window;
+ FVAR (f, minibuffer_window) = mini_window;
/* Make the chosen minibuffer window display the proper minibuffer,
unless it is already showing a minibuffer. */
- if (NILP (Fmemq (XWINDOW (mini_window)->buffer, Vminibuffer_list)))
+ if (NILP (Fmemq (WVAR (XWINDOW (mini_window), buffer), Vminibuffer_list)))
Fset_window_buffer (mini_window,
(NILP (Vminibuffer_list)
? get_minibuffer (0)
Avoid infinite looping on the window chain by marking next pointer
as nil. */
- mini_window = f->minibuffer_window = f->root_window;
- XWINDOW (mini_window)->mini_p = Qt;
- XWINDOW (mini_window)->next = Qnil;
- XWINDOW (mini_window)->prev = Qnil;
- XWINDOW (mini_window)->frame = frame;
+ mini_window = FVAR (f, minibuffer_window) = FVAR (f, root_window);
+ XWINDOW (mini_window)->mini = 1;
+ WVAR (XWINDOW (mini_window), next) = Qnil;
+ WVAR (XWINDOW (mini_window), prev) = Qnil;
+ WVAR (XWINDOW (mini_window), frame) = frame;
/* Put the proper buffer in that window. */
Vframe_list = Fcons (frame, Vframe_list);
tty_frame_count = 1;
- f->name = make_pure_c_string ("F1");
+ FVAR (f, name) = build_pure_c_string ("F1");
f->visible = 1;
f->async_visible = 1;
XSETFRAME (frame, f);
Vframe_list = Fcons (frame, Vframe_list);
- tty_frame_count++;
- sprintf (name, "F%"pMd, tty_frame_count);
- f->name = build_string (name);
+ FVAR (f, name) = make_formatted_string (name, "F%"pMd, ++tty_frame_count);
f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
f->async_visible = 1; /* Don't let visible be cleared later. */
result = Fassq (parameter, supplied_parms);
if (NILP (result))
- result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
+ result = Fassq (parameter, FVAR (XFRAME (selected_frame), param_alist));
if (NILP (result) && current_value != NULL)
result = build_string (current_value);
if (!NILP (result) && !STRINGP (result))
doc: /* Create an additional terminal frame, possibly on another terminal.
This function takes one argument, an alist specifying frame parameters.
-You can create multiple frames on a single text-only terminal, but
-only one of them (the selected terminal frame) is actually displayed.
+You can create multiple frames on a single text terminal, but only one
+of them (the selected terminal frame) is actually displayed.
In practice, generally you don't need to specify any parameters,
except when you want to create a new frame on another terminal.
: NULL));
if (!NILP (tty))
{
- name = (char *) alloca (SBYTES (tty) + 1);
- strncpy (name, SSDATA (tty), SBYTES (tty));
+ name = alloca (SBYTES (tty) + 1);
+ memcpy (name, SSDATA (tty), SBYTES (tty));
name[SBYTES (tty)] = 0;
}
: NULL));
if (!NILP (tty_type))
{
- type = (char *) alloca (SBYTES (tty_type) + 1);
- strncpy (type, SSDATA (tty_type), SBYTES (tty_type));
+ type = alloca (SBYTES (tty_type) + 1);
+ memcpy (type, SSDATA (tty_type), SBYTES (tty_type));
type[SBYTES (tty_type)] = 0;
}
/* Make the frame face alist be frame-specific, so that each
frame could change its face definitions independently. */
- f->face_alist = Fcopy_alist (sf->face_alist);
+ FVAR (f, face_alist) = Fcopy_alist (FVAR (sf, face_alist));
/* Simple Fcopy_alist isn't enough, because we need the contents of
the vectors which are the CDRs of associations in face_alist to
be copied as well. */
- for (tem = f->face_alist; CONSP (tem); tem = XCDR (tem))
+ for (tem = FVAR (f, face_alist); CONSP (tem); tem = XCDR (tem))
XSETCDR (XCAR (tem), Fcopy_sequence (XCDR (XCAR (tem))));
return frame;
}
if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame)))
last_nonminibuf_frame = XFRAME (selected_frame);
- Fselect_window (XFRAME (frame)->selected_window, norecord);
+ Fselect_window (FVAR (XFRAME (frame), selected_window), norecord);
/* We want to make sure that the next event generates a frame-switch
event to the appropriate frame. This seems kludgy to me, but
this function is called. If you are using a window system, the
previously selected frame may be restored as the selected 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.
+the window system's input focus. On a text terminal, the next
+redisplay will display FRAME.
This function returns FRAME, or nil if FRAME has been deleted. */)
(Lisp_Object frame, Lisp_Object norecord)
described for Fdelete_frame. */
Lisp_Object
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. */
-
{
struct frame *f;
struct frame *sf = SELECTED_FRAME ();
FOR_EACH_FRAME (tail, frame1)
{
if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1)))
- break;
+ {
+ /* Do not change a text terminal's top-frame. */
+ struct frame *f1 = XFRAME (frame1);
+ if (FRAME_TERMCAP_P (f1) || FRAME_MSDOS_P (f1))
+ {
+ Lisp_Object top_frame = FRAME_TTY (f1)->top_frame;
+ if (!EQ (top_frame, frame))
+ frame1 = top_frame;
+ }
+ break;
+ }
}
}
#ifdef NS_IMPL_COCOA
}
/* Don't allow minibuf_window to remain on a deleted frame. */
- if (EQ (f->minibuffer_window, minibuf_window))
+ if (EQ (FVAR (f, minibuffer_window), minibuf_window))
{
- Fset_window_buffer (sf->minibuffer_window,
- XWINDOW (minibuf_window)->buffer, Qnil);
- minibuf_window = sf->minibuffer_window;
+ Fset_window_buffer (FVAR (sf, minibuffer_window),
+ WVAR (XWINDOW (minibuf_window), buffer), Qnil);
+ minibuf_window = FVAR (sf, minibuffer_window);
/* If the dying minibuffer window was selected,
select the new one. */
}
/* Don't let echo_area_window to remain on a deleted frame. */
- if (EQ (f->minibuffer_window, echo_area_window))
- echo_area_window = sf->minibuffer_window;
+ if (EQ (FVAR (f, minibuffer_window), echo_area_window))
+ echo_area_window = FVAR (sf, minibuffer_window);
/* Clear any X selections for this frame. */
#ifdef HAVE_X_WINDOWS
/* Mark all the windows that used to be on FRAME as deleted, and then
remove the reference to them. */
- delete_all_child_windows (f->root_window);
- f->root_window = Qnil;
+ delete_all_child_windows (FVAR (f, root_window));
+ FVAR (f, root_window) = Qnil;
Vframe_list = Fdelq (frame, Vframe_list);
FRAME_SET_VISIBLE (f, 0);
garbage collection. The frame object itself may not be garbage
collected until much later, because recent_keys and other data
structures can still refer to it. */
- f->menu_bar_vector = Qnil;
+ FVAR (f, menu_bar_vector) = Qnil;
free_font_driver_list (f);
xfree (f->namebuf);
(Lisp_Object frame, Lisp_Object x, Lisp_Object y)
{
CHECK_LIVE_FRAME (frame);
- CHECK_NUMBER (x);
- CHECK_NUMBER (y);
+ CHECK_TYPE_RANGED_INTEGER (int, x);
+ CHECK_TYPE_RANGED_INTEGER (int, y);
/* I think this should be done with a hook. */
#ifdef HAVE_WINDOW_SYSTEM
(Lisp_Object frame, Lisp_Object x, Lisp_Object y)
{
CHECK_LIVE_FRAME (frame);
- CHECK_NUMBER (x);
- CHECK_NUMBER (y);
+ CHECK_TYPE_RANGED_INTEGER (int, x);
+ CHECK_TYPE_RANGED_INTEGER (int, y);
/* I think this should be done with a hook. */
#ifdef HAVE_WINDOW_SYSTEM
}
#endif
- make_frame_visible_1 (XFRAME (frame)->root_window);
+ make_frame_visible_1 (FVAR (XFRAME (frame), root_window));
/* Make menu bar update for the Buffers and Frames menus. */
windows_or_buffers_changed++;
{
struct window *w;
- for (;!NILP (window); window = w->next)
+ for (;!NILP (window); window = WVAR (w, next))
{
w = XWINDOW (window);
- if (!NILP (w->buffer))
- BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time ();
+ if (!NILP (WVAR (w, buffer)))
+ BVAR (XBUFFER (WVAR (w, buffer)), display_time) = Fcurrent_time ();
- if (!NILP (w->vchild))
- make_frame_visible_1 (w->vchild);
- if (!NILP (w->hchild))
- make_frame_visible_1 (w->hchild);
+ if (!NILP (WVAR (w, vchild)))
+ make_frame_visible_1 (WVAR (w, vchild));
+ if (!NILP (WVAR (w, hchild)))
+ make_frame_visible_1 (WVAR (w, hchild));
}
}
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.
-This function has no effect on text-only terminal frames. Such frames
-are always considered visible, whether or not they are currently being
+This function has no effect on text terminal frames. Such frames are
+always considered visible, whether or not they are currently being
displayed in the terminal. */)
(Lisp_Object frame, Lisp_Object force)
{
if (NILP (force) && !other_visible_frames (XFRAME (frame)))
error ("Attempt to make invisible the sole visible or iconified 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))
- do_switch_frame (next_frame (frame, Qt), 0, 0, Qnil)
-#endif
-
/* Don't allow minibuf_window to remain on a deleted frame. */
- if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window))
+ if (EQ (FVAR (XFRAME (frame), minibuffer_window), minibuf_window))
{
struct frame *sf = XFRAME (selected_frame);
- Fset_window_buffer (sf->minibuffer_window,
- XWINDOW (minibuf_window)->buffer, Qnil);
- minibuf_window = sf->minibuffer_window;
+ Fset_window_buffer (FVAR (sf, minibuffer_window),
+ WVAR (XWINDOW (minibuf_window), buffer), Qnil);
+ minibuf_window = FVAR (sf, minibuffer_window);
}
/* I think this should be done with a hook. */
#endif
/* Don't allow minibuf_window to remain on a deleted frame. */
- if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window))
+ if (EQ (FVAR (XFRAME (frame), minibuffer_window), minibuf_window))
{
struct frame *sf = XFRAME (selected_frame);
- Fset_window_buffer (sf->minibuffer_window,
- XWINDOW (minibuf_window)->buffer, Qnil);
- minibuf_window = sf->minibuffer_window;
+ Fset_window_buffer (FVAR (sf, minibuffer_window),
+ WVAR (XWINDOW (minibuf_window), buffer), Qnil);
+ minibuf_window = FVAR (sf, minibuffer_window);
}
/* I think this should be done with a hook. */
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.
+If FRAME is a text terminal frame, this always returns t.
Such frames are always considered visible, whether or not they are
currently being displayed on the terminal. */)
(Lisp_Object frame)
f = XFRAME (frame);
if (FRAME_TERMCAP_P (f))
- /* On a text-only terminal select FRAME. */
+ /* On a text terminal select FRAME. */
Fselect_frame (frame, Qnil);
else
/* Do like the documentation says. */
request a switch to FOCUS-FRAME, and `last-event-frame' will be
FOCUS-FRAME after reading an event typed at FRAME.
-If FOCUS-FRAME is omitted or nil, any existing redirection is
-canceled, and the frame again receives its own keystrokes.
+If FOCUS-FRAME is nil, any existing redirection is canceled, and the
+frame again receives its own keystrokes.
Focus redirection is useful for temporarily redirecting keystrokes to
a surrogate minibuffer frame when a frame doesn't have its own
f = XFRAME (frame);
- f->focus_frame = focus_frame;
+ FVAR (f, focus_frame) = focus_frame;
if (FRAME_TERMINAL (f)->frame_rehighlight_hook)
(*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f);
\f
/* Return the value of frame parameter PROP in frame FRAME. */
+#ifdef HAVE_WINDOW_SYSTEM
#if !HAVE_NS
static
#endif
{
register Lisp_Object tem;
- tem = Fassq (prop, frame->param_alist);
+ tem = Fassq (prop, FVAR (frame, param_alist));
if (EQ (tem, Qnil))
return tem;
return Fcdr (tem);
}
+#endif
/* Return the buffer-predicate of the selected frame. */
Lisp_Object
frame_buffer_predicate (Lisp_Object frame)
{
- return XFRAME (frame)->buffer_predicate;
+ return FVAR (XFRAME (frame), buffer_predicate);
}
/* Return the buffer-list of the selected frame. */
static Lisp_Object
frame_buffer_list (Lisp_Object frame)
{
- return XFRAME (frame)->buffer_list;
+ return FVAR (XFRAME (frame), buffer_list);
}
/* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
FOR_EACH_FRAME (tail, frame)
{
- XFRAME (frame)->buffer_list
- = Fdelq (buffer, XFRAME (frame)->buffer_list);
- XFRAME (frame)->buried_buffer_list
- = Fdelq (buffer, XFRAME (frame)->buried_buffer_list);
+ FVAR (XFRAME (frame), buffer_list)
+ = Fdelq (buffer, FVAR (XFRAME (frame), buffer_list));
+ FVAR (XFRAME (frame), buried_buffer_list)
+ = Fdelq (buffer, FVAR (XFRAME (frame), buried_buffer_list));
}
}
}
static int
-frame_name_fnn_p (char *str, EMACS_INT len)
+frame_name_fnn_p (char *str, ptrdiff_t len)
{
if (len > 1 && str[0] == 'F' && '0' <= str[1] && str[1] <= '9')
{
/* Check for no change needed in this very common case
before we do any consing. */
- if (frame_name_fnn_p (SSDATA (f->name),
- SBYTES (f->name)))
+ if (frame_name_fnn_p (SSDATA (FVAR (f, name)),
+ SBYTES (FVAR (f, name))))
return;
- tty_frame_count++;
- sprintf (namebuf, "F%"pMd, tty_frame_count);
- name = build_string (namebuf);
+ name = make_formatted_string (namebuf, "F%"pMd, ++tty_frame_count);
}
else
{
CHECK_STRING (name);
/* Don't change the name if it's already NAME. */
- if (! NILP (Fstring_equal (name, f->name)))
+ if (! NILP (Fstring_equal (name, FVAR (f, name))))
return;
/* Don't allow the user to set the frame name to F<num>, so it
error ("Frame names of the form F<num> are usurped by Emacs");
}
- f->name = name;
+ FVAR (f, name) = name;
update_mode_lines = 1;
}
for (; CONSP (val); val = XCDR (val))
if (!NILP (Fbuffer_live_p (XCAR (val))))
list = Fcons (XCAR (val), list);
- f->buffer_list = Fnreverse (list);
+ FVAR (f, buffer_list) = Fnreverse (list);
return;
}
if (EQ (prop, Qburied_buffer_list))
for (; CONSP (val); val = XCDR (val))
if (!NILP (Fbuffer_live_p (XCAR (val))))
list = Fcons (XCAR (val), list);
- f->buried_buffer_list = Fnreverse (list);
+ FVAR (f, buried_buffer_list) = Fnreverse (list);
return;
}
FRAME_TTY (f)->previous_frame = NULL;
/* Update the frame parameter alist. */
- old_alist_elt = Fassq (prop, f->param_alist);
+ old_alist_elt = Fassq (prop, FVAR (f, param_alist));
if (EQ (old_alist_elt, Qnil))
- f->param_alist = Fcons (Fcons (prop, val), f->param_alist);
+ FVAR (f, param_alist) = Fcons (Fcons (prop, val), FVAR (f, param_alist));
else
Fsetcdr (old_alist_elt, val);
in addition to the alist. */
if (EQ (prop, Qbuffer_predicate))
- f->buffer_predicate = val;
+ FVAR (f, buffer_predicate) = val;
if (! FRAME_WINDOW_P (f))
{
error ("Surrogate minibuffer windows must be minibuffer windows");
if ((FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
- && !EQ (val, f->minibuffer_window))
+ && !EQ (val, FVAR (f, minibuffer_window)))
error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
/* Install the chosen minibuffer window, with proper buffer. */
- f->minibuffer_window = val;
+ FVAR (f, minibuffer_window) = val;
}
}
if (!FRAME_LIVE_P (f))
return Qnil;
- alist = Fcopy_alist (f->param_alist);
+ alist = Fcopy_alist (FVAR (f, param_alist));
GCPRO1 (alist);
if (!FRAME_WINDOW_P (f))
: FRAME_W32_P (f) ? "w32term"
:"tty"));
}
- store_in_alist (&alist, Qname, f->name);
+ store_in_alist (&alist, Qname, FVAR (f, name));
height = (f->new_text_lines ? f->new_text_lines : FRAME_LINES (f));
store_in_alist (&alist, Qheight, make_number (height));
width = (f->new_text_cols ? f->new_text_cols : FRAME_COLS (f));
: FRAME_MINIBUF_WINDOW (f)));
store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil));
store_in_alist (&alist, Qbuffer_list, frame_buffer_list (frame));
- store_in_alist (&alist, Qburied_buffer_list, XFRAME (frame)->buried_buffer_list);
+ store_in_alist (&alist, Qburied_buffer_list,
+ FVAR (XFRAME (frame), buried_buffer_list));
/* I think this should be done with a hook. */
#ifdef HAVE_WINDOW_SYSTEM
{
/* Avoid consing in frequent cases. */
if (EQ (parameter, Qname))
- value = f->name;
+ value = FVAR (f, name);
#ifdef HAVE_X_WINDOWS
else if (EQ (parameter, Qdisplay) && FRAME_X_P (f))
value = XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element);
else if (EQ (parameter, Qbackground_color)
|| EQ (parameter, Qforeground_color))
{
- value = Fassq (parameter, f->param_alist);
+ value = Fassq (parameter, FVAR (f, param_alist));
if (CONSP (value))
{
value = XCDR (value);
if (STRINGP (value) && !FRAME_WINDOW_P (f))
{
const char *color_name;
- EMACS_INT csz;
+ ptrdiff_t csz;
if (EQ (parameter, Qbackground_color))
{
}
else if (EQ (parameter, Qdisplay_type)
|| EQ (parameter, Qbackground_mode))
- value = Fcdr (Fassq (parameter, f->param_alist));
+ value = Fcdr (Fassq (parameter, FVAR (f, param_alist)));
else
/* FIXME: Avoid this code path at all (as well as code duplication)
by sharing more code with Fframe_parameters. */
#endif
{
- int length = XINT (Flength (alist));
- int i;
- Lisp_Object *parms
- = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
- Lisp_Object *values
- = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
+ EMACS_INT length = XFASTINT (Flength (alist));
+ ptrdiff_t i;
+ Lisp_Object *parms;
+ Lisp_Object *values;
+ USE_SAFE_ALLOCA;
+ SAFE_ALLOCA_LISP (parms, 2 * length);
+ values = parms + length;
/* Extract parm names and values into those vectors. */
|| EQ (prop, Qbackground_color))
update_face_from_frame_parameter (f, prop, val);
}
+
+ SAFE_FREE ();
}
return Qnil;
}
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
+For a text 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'). */)
(Lisp_Object frame)
used. */)
(Lisp_Object frame)
{
- struct frame *f;
-
if (NILP (frame))
frame = selected_frame;
CHECK_FRAME (frame);
- f = XFRAME (frame);
#ifdef FRAME_TOOLBAR_WIDTH
- if (FRAME_WINDOW_P (f))
- return make_number (FRAME_TOOLBAR_WIDTH (f));
+ if (FRAME_WINDOW_P (XFRAME (frame)))
+ return make_number (FRAME_TOOLBAR_WIDTH (XFRAME (frame)));
#endif
return make_number (0);
}
{
register struct frame *f;
- CHECK_NUMBER (lines);
+ CHECK_TYPE_RANGED_INTEGER (int, lines);
if (NILP (frame))
frame = selected_frame;
CHECK_LIVE_FRAME (frame);
(Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend)
{
register struct frame *f;
- CHECK_NUMBER (cols);
+ CHECK_TYPE_RANGED_INTEGER (int, cols);
if (NILP (frame))
frame = selected_frame;
CHECK_LIVE_FRAME (frame);
register struct frame *f;
CHECK_LIVE_FRAME (frame);
- CHECK_NUMBER (cols);
- CHECK_NUMBER (rows);
+ CHECK_TYPE_RANGED_INTEGER (int, cols);
+ CHECK_TYPE_RANGED_INTEGER (int, rows);
f = XFRAME (frame);
/* I think this should be done with a hook. */
register struct frame *f;
CHECK_LIVE_FRAME (frame);
- CHECK_NUMBER (xoffset);
- CHECK_NUMBER (yoffset);
+ CHECK_TYPE_RANGED_INTEGER (int, xoffset);
+ CHECK_TYPE_RANGED_INTEGER (int, yoffset);
f = XFRAME (frame);
/* I think this should be done with a hook. */
struct gcpro gcpro1, gcpro2;
i = 0;
- for (tail = alist; CONSP (tail); tail = Fcdr (tail))
+ for (tail = alist; CONSP (tail); tail = XCDR (tail))
i++;
- parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
- values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
+ parms = alloca (i * sizeof *parms);
+ values = alloca (i * sizeof *values);
/* Extract parm names and values into those vectors. */
prop = parms[i];
val = values[i];
- if (EQ (prop, Qwidth) && NATNUMP (val))
+ if (EQ (prop, Qwidth) && RANGED_INTEGERP (0, val, INT_MAX))
{
size_changed = 1;
width = XFASTINT (val);
}
- else if (EQ (prop, Qheight) && NATNUMP (val))
+ else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX))
{
size_changed = 1;
height = XFASTINT (val);
}
/* If one of the icon positions was not set, preserve or default it. */
- if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
+ if (! TYPE_RANGED_INTEGERP (int, icon_left))
{
icon_left_no_change = 1;
- icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
+ icon_left = Fcdr (Fassq (Qicon_left, FVAR (f, param_alist)));
if (NILP (icon_left))
XSETINT (icon_left, 0);
}
- if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
+ if (! TYPE_RANGED_INTEGERP (int, icon_top))
{
icon_top_no_change = 1;
- icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
+ icon_top = Fcdr (Fassq (Qicon_top, FVAR (f, param_alist)));
if (NILP (icon_top))
XSETINT (icon_top, 0);
}
actually a pointer. Explicit casting avoids compiler
warnings. */
w = (unsigned long) FRAME_X_WINDOW (f);
- sprintf (buf, "%lu", w);
store_in_alist (alistptr, Qwindow_id,
- build_string (buf));
+ make_formatted_string (buf, "%lu", w));
#ifdef HAVE_X_WINDOWS
#ifdef USE_X_TOOLKIT
/* Tooltip frame may not have this widget. */
if (FRAME_X_OUTPUT (f)->widget)
#endif
- {
- w = (unsigned long) FRAME_OUTER_WINDOW (f);
- sprintf (buf, "%lu", w);
- }
+ w = (unsigned long) FRAME_OUTER_WINDOW (f);
store_in_alist (alistptr, Qouter_window_id,
- build_string (buf));
+ make_formatted_string (buf, "%lu", w));
#endif
- store_in_alist (alistptr, Qicon_name, f->icon_name);
+ store_in_alist (alistptr, Qicon_name, FVAR (f, icon_name));
FRAME_SAMPLE_VISIBILITY (f);
store_in_alist (alistptr, Qvisibility,
(FRAME_VISIBLE_P (f) ? Qt
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);
- store_in_alist (alistptr, Qtool_bar_position, f->tool_bar_position);
+ store_in_alist (alistptr, Qtool_bar_position, FVAR (f, tool_bar_position));
}
{
if (NILP (new_value))
f->extra_line_spacing = 0;
- else if (NATNUMP (new_value))
+ else if (RANGED_INTEGERP (0, new_value, INT_MAX))
f->extra_line_spacing = XFASTINT (new_value);
else
signal_error ("Invalid line-spacing", new_value);
signal_error ("Invalid screen-gamma", new_value);
/* Apply the new gamma value to the frame background. */
- bgcolor = Fassq (Qbackground_color, f->param_alist);
+ bgcolor = Fassq (Qbackground_color, FVAR (f, param_alist));
if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
{
Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter);
void
x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
- Lisp_Object font_object, font_param = Qnil;
+ Lisp_Object font_object;
int fontset = -1;
+#ifdef HAVE_X_WINDOWS
+ Lisp_Object font_param = arg;
+#endif
/* Set the frame parameter back to the old value because we may
fail to use ARG as the new parameter value. */
never fail. */
if (STRINGP (arg))
{
- font_param = arg;
fontset = fs_query_fontset (arg, 0);
if (fontset < 0)
{
- font_object = font_open_by_name (f, SSDATA (arg));
+ font_object = font_open_by_name (f, arg);
if (NILP (font_object))
error ("Font `%s' is not defined", SSDATA (arg));
arg = AREF (font_object, FONT_NAME_INDEX);
}
else if (fontset > 0)
{
- Lisp_Object ascii_font = fontset_ascii (fontset);
-
- font_object = font_open_by_name (f, SSDATA (ascii_font));
+ font_object = font_open_by_name (f, fontset_ascii (fontset));
if (NILP (font_object))
error ("Font `%s' is not defined", SDATA (arg));
arg = AREF (font_object, FONT_NAME_INDEX);
error ("Unknown fontset: %s", SDATA (XCAR (arg)));
font_object = XCDR (arg);
arg = AREF (font_object, FONT_NAME_INDEX);
+#ifdef HAVE_X_WINDOWS
font_param = Ffont_get (font_object, QCname);
+#endif
}
else if (FONT_OBJECT_P (arg))
{
font_object = arg;
+#ifdef HAVE_X_WINDOWS
font_param = Ffont_get (font_object, QCname);
+#endif
/* This is to store the XLFD font name in the frame parameter for
backward compatibility. We should store the font-object
itself in the future. */
void
x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
- CHECK_NUMBER (arg);
+ CHECK_TYPE_RANGED_INTEGER (int, arg);
if (XINT (arg) == f->border_width)
return;
{
int old = FRAME_INTERNAL_BORDER_WIDTH (f);
- CHECK_NUMBER (arg);
+ CHECK_TYPE_RANGED_INTEGER (int, arg);
FRAME_INTERNAL_BORDER_WIDTH (f) = XINT (arg);
if (FRAME_INTERNAL_BORDER_WIDTH (f) < 0)
FRAME_INTERNAL_BORDER_WIDTH (f) = 0;
{
Lisp_Object tem;
- tem = assq_no_quit (Qicon_type, f->param_alist);
+ tem = assq_no_quit (Qicon_type, FVAR (f, param_alist));
if (CONSP (tem))
return XCDR (tem);
else
/* Allocate space for the components, the dots which separate them,
and the final '\0'. Make them big enough for the worst case. */
- name_key = (char *) alloca (SBYTES (Vx_resource_name)
- + (STRINGP (component)
- ? SBYTES (component) : 0)
- + SBYTES (attribute)
- + 3);
-
- class_key = (char *) alloca (SBYTES (Vx_resource_class)
- + SBYTES (class)
- + (STRINGP (subclass)
- ? SBYTES (subclass) : 0)
- + 3);
+ name_key = alloca (SBYTES (Vx_resource_name)
+ + (STRINGP (component)
+ ? SBYTES (component) : 0)
+ + SBYTES (attribute)
+ + 3);
+
+ class_key = alloca (SBYTES (Vx_resource_class)
+ + SBYTES (class)
+ + (STRINGP (subclass)
+ ? SBYTES (subclass) : 0)
+ + 3);
/* Start with emacs.FRAMENAME for the name (the specific one)
and with `Emacs' for the class key (the general one). */
/* Allocate space for the components, the dots which separate them,
and the final '\0'. */
SAFE_ALLOCA (name_key, char *, invocation_namelen + strlen (attribute) + 2);
- class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
- + strlen (class) + 2);
+ class_key = alloca ((sizeof (EMACS_CLASS) - 1) + strlen (class) + 2);
esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute);
sprintf (class_key, "%s.%s", EMACS_CLASS, class);
(Lisp_Object string)
{
#ifdef HAVE_NS
- call1 (Qns_parse_geometry, string);
+ return call1 (Qns_parse_geometry, string);
#else
int geometry, x, y;
unsigned int width, height;
f->top_pos = 0;
else
{
- CHECK_NUMBER (tem0);
+ CHECK_TYPE_RANGED_INTEGER (int, tem0);
f->top_pos = XINT (tem0);
if (f->top_pos < 0)
window_prompting |= YNegative;
f->left_pos = 0;
else
{
- CHECK_NUMBER (tem1);
+ CHECK_TYPE_RANGED_INTEGER (int, tem1);
f->left_pos = XINT (tem1);
if (f->left_pos < 0)
window_prompting |= XNegative;