/* Generic frame functions.
- Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+Copyright (C) 1993-1995, 1997, 1999-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <stdio.h>
#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
#include <setjmp.h>
#include "lisp.h"
#include "character.h"
#endif
-/* If we shall make pointer invisible when typing or not. */
-Lisp_Object Vmake_pointer_invisible;
-
#ifdef HAVE_WINDOW_SYSTEM
-/* The name we're using in resource queries. Most often "emacs". */
-
-Lisp_Object Vx_resource_name;
-
-/* The application class we're using in resource queries.
- Normally "Emacs". */
-
-Lisp_Object Vx_resource_class;
-
-/* Lower limit value of the frame opacity (alpha transparency). */
-
-Lisp_Object Vframe_alpha_lower_limit;
-
#endif
#ifdef HAVE_NS
Lisp_Object Qheight, Qwidth;
Lisp_Object Qleft, Qright;
Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name;
+Lisp_Object Qtooltip;
Lisp_Object Qinternal_border_width;
Lisp_Object Qmouse_color;
Lisp_Object Qminibuffer;
Lisp_Object Qtitle, Qname;
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 Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position;
Lisp_Object Qleft_fringe, Qright_fringe;
Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list;
Lisp_Object Qtty_color_mode;
Lisp_Object Qface_set_after_frame_default;
-Lisp_Object Vterminal_frame;
-Lisp_Object Vdefault_frame_alist;
-Lisp_Object Vdefault_frame_scroll_bars;
-Lisp_Object Vmouse_position_function;
-Lisp_Object Vmouse_highlight;
-static Lisp_Object Vdelete_frame_functions, Qdelete_frame_functions;
+static Lisp_Object Qdelete_frame_functions;
-int focus_follows_mouse;
\f
static void
set_menu_bar_lines_1 (Lisp_Object window, int n)
\f
Lisp_Object Vframe_list;
-extern Lisp_Object Vminibuffer_list;
-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 (struct frame *frame);
-extern Lisp_Object QCname, Qfont_param;
-
\f
DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
doc: /* Return non-nil if OBJECT is a frame.
-Value is t for a termcap frame (a character-only terminal),
-`x' for an Emacs frame that is really an X window,
-`w32' for an Emacs frame that is a window on MS-Windows display,
-`ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
-`pc' for a direct-write MS-DOS frame.
+Value is:
+ t for a termcap frame (a character-only terminal),
+ 'x' for an Emacs frame that is really an X window,
+ 'w32' for an Emacs frame that is a window on MS-Windows display,
+ 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
+ 'pc' for a direct-write MS-DOS frame.
See also `frame-live-p'. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (!FRAMEP (object))
return Qnil;
frame, the return value indicates what sort of terminal device it is
displayed on. See the documentation of `framep' for possible
return values. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
return ((FRAMEP (object)
&& FRAME_LIVE_P (XFRAME (object)))
DEFUN ("window-system", Fwindow_system, Swindow_system, 0, 1, 0,
doc: /* The name of the window system that FRAME is displaying through.
-The value is a symbol---for instance, 'x' for X windows.
-The value is nil if Emacs is using a text-only terminal.
-
-FRAME defaults to the currently selected frame. */)
- (frame)
- Lisp_Object frame;
+The value is a symbol:
+ nil for a termcap frame (a character-only terminal),
+ 'x' for an Emacs frame that is really an X window,
+ 'w32' for an Emacs frame that is a window on MS-Windows display,
+ 'ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
+ 'pc' for a direct-write MS-DOS frame.
+
+FRAME defaults to the currently selected frame.
+
+Use of this function as a predicate is deprecated. Instead,
+use `display-graphic-p' or any of the other `display-*-p'
+predicates which report frame's specific UI-related capabilities. */)
+ (Lisp_Object frame)
{
Lisp_Object type;
if (NILP (frame))
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;
if (NILP (mini_window))
{
/* Use default-minibuffer-frame if possible. */
- if (!FRAMEP (kb->Vdefault_minibuffer_frame)
- || ! FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))
+ if (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
+ || ! FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))
{
Lisp_Object frame_dummy;
XSETFRAME (frame_dummy, f);
GCPRO1 (frame_dummy);
/* If there's no minibuffer frame to use, create one. */
- kb->Vdefault_minibuffer_frame =
+ KVAR (kb, Vdefault_minibuffer_frame) =
call1 (intern ("make-initial-minibuffer-frame"), display);
UNGCPRO;
}
- mini_window = XFRAME (kb->Vdefault_minibuffer_frame)->minibuffer_window;
+ mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window;
}
f->minibuffer_window = mini_window;
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
+ /* The default value of menu-bar-mode is t. */
+ set_menu_bar_lines (f, make_number (1), Qnil);
+
#ifdef CANNOT_DUMP
if (!noninteractive)
init_frame_faces (f);
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
+ FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1;
/* Set the top frame to the newly created frame. */
if (FRAMEP (FRAME_TTY (f)->top_frame)
Note that changing the size of one terminal frame automatically
affects all frames on the same terminal device. */)
- (parms)
- Lisp_Object parms;
+ (Lisp_Object parms)
{
struct frame *f;
struct terminal *t = NULL;
if (!NILP (tty))
{
name = (char *) alloca (SBYTES (tty) + 1);
- strncpy (name, SDATA (tty), SBYTES (tty));
+ strncpy (name, SSDATA (tty), SBYTES (tty));
name[SBYTES (tty)] = 0;
}
if (!NILP (tty_type))
{
type = (char *) alloca (SBYTES (tty_type) + 1);
- strncpy (type, SDATA (tty_type), SBYTES (tty_type));
+ strncpy (type, SSDATA (tty_type), SBYTES (tty_type));
type[SBYTES (tty_type)] = 0;
}
next redisplay will display FRAME.
This function returns FRAME, or nil if FRAME has been deleted. */)
- (frame, norecord)
- Lisp_Object frame, norecord;
+ (Lisp_Object frame, Lisp_Object norecord)
{
return do_switch_frame (frame, 1, 0, norecord);
}
If EVENT is frame object, handle it as if it were a switch-frame event
to that frame. */)
- (event)
- Lisp_Object event;
+ (Lisp_Object event)
{
/* Preserve prefix arg that the command loop just cleared. */
- current_kboard->Vprefix_arg = Vcurrent_prefix_arg;
+ KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg;
call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
return do_switch_frame (event, 0, 0, Qnil);
}
DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
doc: /* Return the frame that is now selected. */)
- ()
+ (void)
{
return selected_frame;
}
\f
DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
doc: /* Return the frame object that window WINDOW is on. */)
- (window)
- Lisp_Object window;
+ (Lisp_Object window)
{
CHECK_LIVE_WINDOW (window);
return XWINDOW (window)->frame;
DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0,
doc: /* Returns the topmost, leftmost window of FRAME.
If omitted, FRAME defaults to the currently selected frame. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
Lisp_Object w;
DEFUN ("active-minibuffer-window", Factive_minibuffer_window,
Sactive_minibuffer_window, 0, 0, 0,
doc: /* Return the currently active minibuffer window, or nil if none. */)
- ()
+ (void)
{
return minibuf_level ? minibuf_window : Qnil;
}
DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
doc: /* Returns the root-window of FRAME.
If omitted, FRAME defaults to the currently selected frame. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
Lisp_Object window;
Sframe_selected_window, 0, 1, 0,
doc: /* Return the selected window of FRAME.
FRAME defaults to the currently selected frame. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
Lisp_Object window;
Optional argument NORECORD non-nil means to neither change the
order of recently selected windows nor the buffer list.
Return WINDOW. */)
- (frame, window, norecord)
- Lisp_Object frame, window, norecord;
+ (Lisp_Object frame, Lisp_Object window, Lisp_Object norecord)
{
if (NILP (frame))
frame = selected_frame;
DEFUN ("frame-list", Fframe_list, Sframe_list,
0, 0, 0,
doc: /* Return a list of all live frames. */)
- ()
+ (void)
{
Lisp_Object frames;
frames = Fcopy_sequence (Vframe_list);
If MINIFRAME is `visible', include all visible frames.
If MINIFRAME is 0, include all visible and iconified frames.
Otherwise, include all frames. */)
- (frame, miniframe)
- Lisp_Object frame, miniframe;
+ (Lisp_Object frame, Lisp_Object miniframe)
{
if (NILP (frame))
frame = selected_frame;
If MINIFRAME is `visible', include all visible frames.
If MINIFRAME is 0, include all visible and iconified frames.
Otherwise, include all frames. */)
- (frame, miniframe)
- Lisp_Object frame, miniframe;
+ (Lisp_Object frame, Lisp_Object miniframe)
{
if (NILP (frame))
frame = selected_frame;
return 1;
}
-/* Error handler for `delete-frame-functions'. */
-static Lisp_Object
-delete_frame_handler (Lisp_Object arg)
-{
- add_to_log ("Error during `delete-frame': %s", arg, Qnil);
- return Qnil;
-}
-
-extern Lisp_Object Qrun_hook_with_args;
-
/* Delete FRAME. When FORCE equals Qnoelisp, delete FRAME
unconditionally. x_connection_closed and delete_terminal use
this. Any other value of FORCE implements the semantics
/* 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 ();
struct kboard *kb;
- int minibuffer_selected;
+ int minibuffer_selected, tooltip_frame;
if (EQ (frame, Qnil))
{
}
}
+ tooltip_frame = !NILP (Fframe_parameter (frame, intern ("tooltip")));
+
/* Run `delete-frame-functions' unless FORCE is `noelisp' or
frame is a tooltip. FORCE is set to `noelisp' when handling
a disconnect from the terminal, so we don't dare call Lisp
code. */
- if (NILP (Vrun_hooks) || !NILP (Fframe_parameter (frame, intern ("tooltip"))))
+ if (NILP (Vrun_hooks) || tooltip_frame)
;
- if (EQ (force, Qnoelisp))
+ else if (EQ (force, Qnoelisp))
pending_funcalls
= Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
pending_funcalls);
/* If we've deleted this keyboard's default_minibuffer_frame, try to
find another one. Prefer minibuffer-only frames, but also notice
frames with other windows. */
- if (kb != NULL && EQ (frame, kb->Vdefault_minibuffer_frame))
+ if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)))
{
Lisp_Object frames;
if (NILP (frame_with_minibuf))
abort ();
- kb->Vdefault_minibuffer_frame = frame_with_minibuf;
+ KVAR (kb, Vdefault_minibuffer_frame) = frame_with_minibuf;
}
else
/* No frames left on this kboard--say no minibuffer either. */
- kb->Vdefault_minibuffer_frame = Qnil;
+ KVAR (kb, Vdefault_minibuffer_frame) = Qnil;
}
/* Cause frame titles to update--necessary if we now have just one frame. */
- update_mode_lines = 1;
+ if (!tooltip_frame)
+ update_mode_lines = 1;
return Qnil;
}
This function runs `delete-frame-functions' before actually
deleting the frame, unless the frame is a tooltip.
The functions are run with one argument, the frame to be deleted. */)
- (frame, force)
- Lisp_Object frame, force;
+ (Lisp_Object frame, Lisp_Object force)
{
return delete_frame (frame, !NILP (force) ? Qt : Qnil);
}
If `mouse-position-function' is non-nil, `mouse-position' calls it,
passing the normal return value to that function as an argument,
and returns whatever that function returns. */)
- ()
+ (void)
{
FRAME_PTR f;
Lisp_Object lispy_dummy;
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. */)
- ()
+ (void)
{
FRAME_PTR f;
Lisp_Object lispy_dummy;
If you have just created a frame, you must wait for it to become visible
before calling this function on it, like this.
(while (not (frame-visible-p frame)) (sleep-for .5)) */)
- (frame, x, y)
- Lisp_Object frame, x, y;
+ (Lisp_Object frame, Lisp_Object x, Lisp_Object y)
{
CHECK_LIVE_FRAME (frame);
CHECK_NUMBER (x);
If you have just created a frame, you must wait for it to become visible
before calling this function on it, like this.
(while (not (frame-visible-p frame)) (sleep-for .5)) */)
- (frame, x, y)
- Lisp_Object frame, x, y;
+ (Lisp_Object frame, Lisp_Object x, Lisp_Object y)
{
CHECK_LIVE_FRAME (frame);
CHECK_NUMBER (x);
0, 1, "",
doc: /* Make the frame FRAME visible (assuming it is an X window).
If omitted, FRAME defaults to the currently selected frame. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
if (NILP (frame))
frame = selected_frame;
w = XWINDOW (window);
if (!NILP (w->buffer))
- XBUFFER (w->buffer)->display_time = Fcurrent_time ();
+ BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time ();
if (!NILP (w->vchild))
make_frame_visible_1 (w->vchild);
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;
+ (Lisp_Object frame, Lisp_Object force)
{
if (NILP (frame))
frame = selected_frame;
0, 1, "",
doc: /* Make the frame FRAME into an icon.
If omitted, FRAME defaults to the currently selected frame. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
if (NILP (frame))
frame = selected_frame;
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;
+ (Lisp_Object frame)
{
CHECK_LIVE_FRAME (frame);
DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list,
0, 0, 0,
doc: /* Return a list of all frames now \"visible\" (being updated). */)
- ()
+ (void)
{
Lisp_Object tail, frame;
struct frame *f;
If you don't specify a frame, the selected frame is used.
If Emacs is displaying on an ordinary terminal or some other device which
doesn't support multiple overlapping frames, this function selects FRAME. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
struct frame *f;
if (NILP (frame))
If you don't specify a frame, the selected frame is used.
If Emacs is displaying on an ordinary terminal or some other device which
doesn't support multiple overlapping frames, this function does nothing. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
struct frame *f;
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)
- Lisp_Object frame, focus_frame;
+ (Lisp_Object frame, Lisp_Object focus_frame)
{
struct frame *f;
doc: /* Return the frame to which FRAME's keystrokes are currently being sent.
This returns nil if FRAME's focus is not redirected.
See `redirect-frame-focus'. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
CHECK_LIVE_FRAME (frame);
if (len > 1 && str[0] == 'F')
{
char *end_ptr;
+ long int n;
+ errno = 0;
+ n = strtol (str + 1, &end_ptr, 10);
- strtol (str + 1, &end_ptr, 10);
-
- if (end_ptr == str + len)
+ if (end_ptr == str + len
+ && INT_MIN <= n && n <= INT_MAX
+ && ((LONG_MIN < n && n < LONG_MAX) || errno != ERANGE))
return 1;
}
return 0;
/* Check for no change needed in this very common case
before we do any consing. */
- if (frame_name_fnn_p (SDATA (f->name),
+ if (frame_name_fnn_p (SSDATA (f->name),
SBYTES (f->name)))
return;
/* Don't allow the user to set the frame name to F<num>, so it
doesn't clash with the names we generate for terminal frames. */
- if (frame_name_fnn_p (SDATA (name), SBYTES (name)))
+ if (frame_name_fnn_p (SSDATA (name), SBYTES (name)))
error ("Frame names of the form F<num> are usurped by Emacs");
}
It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
The meaningful PARMs depend on the kind of frame.
If FRAME is omitted, return information on the currently selected frame. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
Lisp_Object alist;
FRAME_PTR f;
elt = Fassq (Qforeground_color, alist);
if (CONSP (elt) && STRINGP (XCDR (elt)))
{
- if (strncmp (SDATA (XCDR (elt)),
+ if (strncmp (SSDATA (XCDR (elt)),
unspecified_bg,
SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qforeground_color, tty_color_name (f, bg));
- else if (strncmp (SDATA (XCDR (elt)),
+ else if (strncmp (SSDATA (XCDR (elt)),
unspecified_fg,
SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg));
elt = Fassq (Qbackground_color, alist);
if (CONSP (elt) && STRINGP (XCDR (elt)))
{
- if (strncmp (SDATA (XCDR (elt)),
+ if (strncmp (SSDATA (XCDR (elt)),
unspecified_fg,
SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qbackground_color, tty_color_name (f, fg));
- else if (strncmp (SDATA (XCDR (elt)),
+ else if (strncmp (SSDATA (XCDR (elt)),
unspecified_bg,
SCHARS (XCDR (elt))) == 0)
store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg));
DEFUN ("frame-parameter", Fframe_parameter, Sframe_parameter, 2, 2, 0,
doc: /* Return FRAME's value for parameter PARAMETER.
If FRAME is nil, describe the currently selected frame. */)
- (frame, parameter)
- Lisp_Object frame, parameter;
+ (Lisp_Object frame, Lisp_Object parameter)
{
struct frame *f;
Lisp_Object value;
if (EQ (parameter, Qbackground_color))
{
- color_name = SDATA (value);
+ color_name = SSDATA (value);
csz = SCHARS (value);
if (strncmp (color_name, unspecified_bg, csz) == 0)
value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f));
}
else if (EQ (parameter, Qforeground_color))
{
- color_name = SDATA (value);
+ color_name = SSDATA (value);
csz = SCHARS (value);
if (strncmp (color_name, unspecified_fg, csz) == 0)
value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f));
enabled such bindings for that variable with `make-variable-frame-local'.
Note that this functionality is obsolete as of Emacs 22.2, and its
use is not recommended. Explicitly check for a frame-parameter instead. */)
- (frame, alist)
- Lisp_Object frame, alist;
+ (Lisp_Object frame, Lisp_Object alist)
{
FRAME_PTR f;
register Lisp_Object tail, prop, val;
doc: /* Height in pixels of a line in the font in frame FRAME.
If FRAME is omitted, the selected frame is used.
For a terminal frame, the value is always 1. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
struct frame *f;
If FRAME is omitted, the selected frame is used.
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;
+ (Lisp_Object frame)
{
struct frame *f;
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;
+ (Lisp_Object frame)
{
struct frame *f;
doc: /* Return FRAME's width in pixels.
For a terminal frame, the result really gives the width in characters.
If FRAME is omitted, the selected frame is used. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
struct frame *f;
#endif
return make_number (FRAME_COLS (f));
}
+
+DEFUN ("tool-bar-pixel-width", Ftool_bar_pixel_width,
+ Stool_bar_pixel_width, 0, 1, 0,
+ doc: /* Return width in pixels of FRAME's tool bar.
+The result is greater than zero only when the tool bar is on the left
+or right side of FRAME. If FRAME is omitted, the selected frame is
+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));
+#endif
+ return make_number (0);
+}
\f
DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
doc: /* Specify that the frame FRAME has LINES lines.
Optional third arg non-nil means that redisplay should use LINES lines
but that the idea of the actual height of the frame should not be changed. */)
- (frame, lines, pretend)
- Lisp_Object frame, lines, pretend;
+ (Lisp_Object frame, Lisp_Object lines, Lisp_Object pretend)
{
register struct frame *f;
doc: /* Specify that the frame FRAME has COLS columns.
Optional third arg non-nil means that redisplay should use COLS columns
but that the idea of the actual width of the frame should not be changed. */)
- (frame, cols, pretend)
- Lisp_Object frame, cols, pretend;
+ (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend)
{
register struct frame *f;
CHECK_NUMBER (cols);
DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
doc: /* Sets size of FRAME to COLS by ROWS, measured in characters. */)
- (frame, cols, rows)
- Lisp_Object frame, cols, rows;
+ (Lisp_Object frame, Lisp_Object cols, Lisp_Object rows)
{
register struct frame *f;
This is actually the position of the upper left corner of the frame.
Negative values for XOFFSET or YOFFSET are interpreted relative to
the rightmost or bottommost possible position (that stays within the screen). */)
- (frame, xoffset, yoffset)
- Lisp_Object frame, xoffset, yoffset;
+ (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset)
{
register struct frame *f;
that is an index in this table. */
struct frame_parm_table {
- char *name;
+ const char *name;
Lisp_Object *variable;
};
-static struct frame_parm_table frame_parms[] =
+static const struct frame_parm_table frame_parms[] =
{
{"auto-raise", &Qauto_raise},
{"auto-lower", &Qauto_lower},
{"font-backend", &Qfont_backend},
{"alpha", &Qalpha},
{"sticky", &Qsticky},
+ {"tool-bar-position", &Qtool_bar_position},
};
#ifdef HAVE_WINDOW_SYSTEM
-extern Lisp_Object Qbox;
-extern Lisp_Object Qtop;
-
/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
wanted positions of the WM window (not Emacs window).
Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
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);
}
bgcolor = Fassq (Qbackground_color, f->param_alist);
if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
{
- Lisp_Object index = Fget (Qbackground_color, Qx_frame_parameter);
- if (NATNUMP (index)
- && (XFASTINT (index)
+ Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter);
+ if (NATNUMP (parm_index)
+ && (XFASTINT (parm_index)
< sizeof (frame_parms)/sizeof (frame_parms[0]))
- && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)])
- (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)])
+ && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
+ (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
(f, bgcolor, Qnil);
}
void
x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
- Lisp_Object frame, font_object, font_param = Qnil;
+ Lisp_Object font_object, font_param = Qnil;
int fontset = -1;
/* Set the frame parameter back to the old value because we may
fontset = fs_query_fontset (arg, 0);
if (fontset < 0)
{
- font_object = font_open_by_name (f, SDATA (arg));
+ font_object = font_open_by_name (f, SSDATA (arg));
if (NILP (font_object))
- error ("Font `%s' is not defined", SDATA (arg));
+ 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, SDATA (ascii_font));
+ font_object = font_open_by_name (f, SSDATA (ascii_font));
if (NILP (font_object))
error ("Font `%s' is not defined", SDATA (arg));
arg = AREF (font_object, FONT_NAME_INDEX);
char *p0, *p1;
CHECK_STRING (new_value);
- p0 = p1 = SDATA (new_value);
+ p0 = p1 = SSDATA (new_value);
new_value = Qnil;
while (*p0)
{
x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
{
compute_fringe_widths (f, 1);
+#ifdef HAVE_X_WINDOWS
+ /* Must adjust this so window managers report correct number of columns. */
+ if (FRAME_X_WINDOW (f) != 0)
+ x_wm_set_size_hint (f, 0, 0);
+#endif
}
void
if (STRINGP (Vx_resource_name))
{
unsigned char *p = SDATA (Vx_resource_name);
- int i;
len = SBYTES (Vx_resource_name);
}
-extern char *x_get_string_resource (XrmDatabase, char *, char *);
+extern char *x_get_string_resource (XrmDatabase, const char *, const char *);
extern Display_Info *check_x_display_info (Lisp_Object);
/* Start with emacs.FRAMENAME for the name (the specific one)
and with `Emacs' for the class key (the general one). */
- strcpy (name_key, SDATA (Vx_resource_name));
- strcpy (class_key, SDATA (Vx_resource_class));
+ strcpy (name_key, SSDATA (Vx_resource_name));
+ strcpy (class_key, SSDATA (Vx_resource_class));
strcat (class_key, ".");
- strcat (class_key, SDATA (class));
+ strcat (class_key, SSDATA (class));
if (!NILP (component))
{
strcat (class_key, ".");
- strcat (class_key, SDATA (subclass));
+ strcat (class_key, SSDATA (subclass));
strcat (name_key, ".");
- strcat (name_key, SDATA (component));
+ strcat (name_key, SSDATA (component));
}
strcat (name_key, ".");
- strcat (name_key, SDATA (attribute));
+ strcat (name_key, SSDATA (attribute));
value = x_get_string_resource (rdb, name_key, class_key);
class, respectively. You must specify both of them or neither.
If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'
and the class is `Emacs.CLASS.SUBCLASS'. */)
- (attribute, class, component, subclass)
- Lisp_Object attribute, class, component, subclass;
+ (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass)
{
#ifdef HAVE_X_WINDOWS
check_x ();
/* Used when C code wants a resource value. */
/* Called from oldXMenu/Create.c. */
char *
-x_get_resource_string (char *attribute, char *class)
+x_get_resource_string (const char *attribute, const char *class)
{
char *name_key;
char *class_key;
and don't let it get stored in any Lisp-visible variables! */
Lisp_Object
-x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
+x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param,
+ const char *attribute, const char *class, enum resource_types type)
{
register Lisp_Object tem;
switch (type)
{
case RES_TYPE_NUMBER:
- return make_number (atoi (SDATA (tem)));
+ return make_number (atoi (SSDATA (tem)));
case RES_TYPE_BOOLEAN_NUMBER:
- if (!strcmp (SDATA (tem), "on")
- || !strcmp (SDATA (tem), "true"))
+ if (!strcmp (SSDATA (tem), "on")
+ || !strcmp (SSDATA (tem), "true"))
return make_number (1);
- return make_number (atoi (SDATA (tem)));
+ return make_number (atoi (SSDATA (tem)));
break;
case RES_TYPE_FLOAT:
- return make_float (atof (SDATA (tem)));
+ return make_float (atof (SSDATA (tem)));
case RES_TYPE_BOOLEAN:
tem = Fdowncase (tem);
- if (!strcmp (SDATA (tem), "on")
+ if (!strcmp (SSDATA (tem), "on")
#ifdef HAVE_NS
- || !strcmp(SDATA(tem), "yes")
+ || !strcmp (SSDATA (tem), "yes")
#endif
- || !strcmp (SDATA (tem), "true"))
+ || !strcmp (SSDATA (tem), "true"))
return Qt;
else
return Qnil;
{
Lisp_Object lower;
lower = Fdowncase (tem);
- if (!strcmp (SDATA (lower), "on")
+ if (!strcmp (SSDATA (lower), "on")
#ifdef HAVE_NS
- || !strcmp(SDATA(lower), "yes")
+ || !strcmp (SSDATA (lower), "yes")
#endif
- || !strcmp (SDATA (lower), "true"))
+ || !strcmp (SSDATA (lower), "true"))
return Qt;
- else if (!strcmp (SDATA (lower), "off")
+ else if (!strcmp (SSDATA (lower), "off")
#ifdef HAVE_NS
- || !strcmp(SDATA(lower), "no")
+ || !strcmp (SSDATA (lower), "no")
#endif
- || !strcmp (SDATA (lower), "false"))
+ || !strcmp (SSDATA (lower), "false"))
return Qnil;
else
return Fintern (tem, Qnil);
return Fcdr (tem);
}
-Lisp_Object
-x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
+static Lisp_Object
+x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param,
+ const char *attribute, const 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 (struct frame *f, Lisp_Object alist, Lisp_Object param, char *attribute, char *class, enum resource_types type)
+x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist,
+ Lisp_Object param,
+ const char *attribute, const char *class,
+ enum resource_types type)
{
Lisp_Object value;
If that is not found either, use the value DEFLT. */
Lisp_Object
-x_default_parameter (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, const char *xprop, const char *xclass,
+ enum resource_types type)
{
Lisp_Object tem;
or a list (+ N) meaning N pixels relative to top/left 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;
+ (Lisp_Object string)
{
#ifdef HAVE_NS
call1 (Qns_parse_geometry, string);
CHECK_STRING (string);
- geometry = XParseGeometry ((char *) SDATA (string),
+ geometry = XParseGeometry (SSDATA (string),
&x, &y, &width, &height);
result = Qnil;
if (geometry & XValue)
}
}
+DEFUN ("frame-pointer-visible-p", Fframe_pointer_visible_p,
+ Sframe_pointer_visible_p, 0, 1, 0,
+ doc: /* Return t if the mouse pointer displayed on FRAME is visible.
+Otherwise it returns nil. FRAME omitted or nil means the
+selected frame. This is useful when `make-pointer-invisible' is set. */)
+ (Lisp_Object frame)
+{
+ if (NILP (frame))
+ frame = selected_frame;
+
+ CHECK_FRAME (frame);
+
+ return (XFRAME (frame)->pointer_invisible ? Qnil : Qt);
+}
\f
/***********************************************************************
staticpro (&Qicon_left);
Qicon_top = intern_c_string ("icon-top");
staticpro (&Qicon_top);
+ Qtooltip = intern_c_string ("tooltip");
+ staticpro (&Qtooltip);
Qleft = intern_c_string ("left");
staticpro (&Qleft);
Qright = intern_c_string ("right");
}
#ifdef HAVE_WINDOW_SYSTEM
- DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
+ DEFVAR_LISP ("x-resource-name", Vx_resource_name,
doc: /* The name Emacs uses to look up X resources.
`x-get-resource' uses this as the first component of the instance name
when requesting resource values.
to `x-get-resource'. See also the variable `x-resource-class'. */);
Vx_resource_name = Qnil;
- DEFVAR_LISP ("x-resource-class", &Vx_resource_class,
+ DEFVAR_LISP ("x-resource-class", Vx_resource_class,
doc: /* The class Emacs uses to look up X resources.
`x-get-resource' uses this as the first component of the instance class
when requesting resource values.
is a reasonable practice. See also the variable `x-resource-name'. */);
Vx_resource_class = build_string (EMACS_CLASS);
- DEFVAR_LISP ("frame-alpha-lower-limit", &Vframe_alpha_lower_limit,
+ DEFVAR_LISP ("frame-alpha-lower-limit", Vframe_alpha_lower_limit,
doc: /* The lower limit of the frame opacity (alpha transparency).
The value should range from 0 (invisible) to 100 (completely opaque).
You can also use a floating number between 0.0 and 1.0.
Vframe_alpha_lower_limit = make_number (20);
#endif
- DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,
+ DEFVAR_LISP ("default-frame-alist", Vdefault_frame_alist,
doc: /* Alist of default values for frame creation.
These may be set in your init file, like this:
(setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1)))
Setting this variable does not affect existing frames, only new ones. */);
Vdefault_frame_alist = Qnil;
- DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars,
+ 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) || (defined(USE_GTK) && defined(USE_TOOLKIT_SCROLL_BARS))
Vdefault_frame_scroll_bars = Qnil;
#endif
- DEFVAR_LISP ("terminal-frame", &Vterminal_frame,
+ DEFVAR_LISP ("terminal-frame", Vterminal_frame,
doc: /* The initial frame-object, which represents Emacs's stdout. */);
- DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function,
+ DEFVAR_LISP ("mouse-position-function", Vmouse_position_function,
doc: /* If non-nil, function to transform normal value of `mouse-position'.
`mouse-position' calls this function, passing its usual return value as
argument, and returns whatever this function returns.
which need to do mouse handling at the Lisp level. */);
Vmouse_position_function = Qnil;
- DEFVAR_LISP ("mouse-highlight", &Vmouse_highlight,
+ DEFVAR_LISP ("mouse-highlight", Vmouse_highlight,
doc: /* If non-nil, clickable text is highlighted when mouse is over it.
If the value is an integer, highlighting is only shown after moving the
mouse, while keyboard input turns off the highlight even when the mouse
when the mouse is over clickable text. */);
Vmouse_highlight = Qt;
- DEFVAR_LISP ("make-pointer-invisible", &Vmake_pointer_invisible,
+ DEFVAR_LISP ("make-pointer-invisible", Vmake_pointer_invisible,
doc: /* If non-nil, make pointer invisible while typing.
The pointer becomes visible again when the mouse is moved. */);
Vmake_pointer_invisible = Qt;
- DEFVAR_LISP ("delete-frame-functions", &Vdelete_frame_functions,
+ DEFVAR_LISP ("delete-frame-functions", Vdelete_frame_functions,
doc: /* Functions to be run before deleting a frame.
The functions are run with one arg, the frame to be deleted.
See `delete-frame'.
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. */);
+ DEFVAR_LISP ("menu-bar-mode", Vmenu_bar_mode,
+ doc: /* Non-nil if Menu-Bar mode is enabled.
+See the command `menu-bar-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `menu-bar-mode'. */);
Vmenu_bar_mode = Qt;
- DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode,
- doc: /* Non-nil if Tool-Bar mode is enabled. */);
+ DEFVAR_LISP ("tool-bar-mode", Vtool_bar_mode,
+ doc: /* Non-nil if Tool-Bar mode is enabled.
+See the command `tool-bar-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `tool-bar-mode'. */);
+#ifdef HAVE_WINDOW_SYSTEM
Vtool_bar_mode = Qt;
+#else
+ Vtool_bar_mode = Qnil;
+#endif
DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
doc: /* Minibufferless frames use this frame's minibuffer.
This variable is local to the current terminal and cannot be buffer-local. */);
- DEFVAR_BOOL ("focus-follows-mouse", &focus_follows_mouse,
+ 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. See also `mouse-autoselect-window'. */);
-#ifdef HAVE_WINDOW_SYSTEM
-#if defined(HAVE_NTGUI) || defined(HAVE_NS)
focus_follows_mouse = 0;
-#else
- focus_follows_mouse = 1;
-#endif
-#else
- focus_follows_mouse = 0;
-#endif
staticpro (&Vframe_list);
defsubr (&Sframe_char_width);
defsubr (&Sframe_pixel_height);
defsubr (&Sframe_pixel_width);
+ defsubr (&Stool_bar_pixel_width);
defsubr (&Sset_frame_height);
defsubr (&Sset_frame_width);
defsubr (&Sset_frame_size);
defsubr (&Sset_frame_position);
+ defsubr (&Sframe_pointer_visible_p);
#ifdef HAVE_WINDOW_SYSTEM
defsubr (&Sx_get_resource);
#endif
}
-
-/* arch-tag: 7dbf2c69-9aad-45f8-8296-db893d6dd039
- (do not change this comment) */