\f
DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 2, "e",
"Select the frame FRAME.\n\
-Subseqent editing commands apply to its selected window.\n\
+Subsequent editing commands apply to its selected window.\n\
The selection of FRAME lasts until the next time the user does\n\
something to select a different frame, or until the next time this\n\
function is called.")
last_nonminibuf_frame = selected_frame;
Fselect_window (XFRAME (frame)->selected_window);
-
- /* I think this should be done with a hook. */
-#ifdef HAVE_X_WINDOWS
- if (FRAME_X_P (XFRAME (frame))
- && NILP (no_enter))
- {
- Ffocus_frame (frame);
- }
-#endif
choose_minibuf_frame ();
/* We want to make sure that the next event generates a frame-switch
- event to the appropriate frame. This seems kludgey to me, but
+ event to the appropriate frame. This seems kludgy to me, but
before you take it out, make sure that evaluating something like
(select-window (frame-root-window (new-frame))) doesn't end up
with your typing being interpreted in the new frame instead of
DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
"Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
+The position is given in character cells, where (0, 0) is the\n\
+upper-left corner.\n\
If Emacs is running on a mouseless terminal or hasn't been programmed\n\
to read the mouse position, it returns the selected frame for FRAME\n\
and nil for X and Y.")
Lisp_Object x, y;
unsigned long long_dummy;
+ f = selected_frame;
+ x = y = Qnil;
+
+ /* It's okay for the hook to refrain from storing anything. */
if (mouse_position_hook)
(*mouse_position_hook) (&f,
&lispy_dummy, &party_dummy,
&x, &y,
&long_dummy);
- else
- {
- f = selected_frame;
- x = y = Qnil;
- }
XSET (lispy_dummy, Lisp_Frame, f);
- return Fcons (lispy_dummy, Fcons (make_number (x), make_number (y)));
+ return Fcons (lispy_dummy, Fcons (x, y));
}
DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
- "Move the mouse pointer to the center of cell (X,Y) in FRAME.\n\
+ "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
WARNING: If you use this under X, you should do `unfocus-frame' afterwards.")
(frame, x, y)
Lisp_Object frame, x, y;
}
\f
DEFUN ("make-frame-visible", Fmake_frame_visible, Smake_frame_visible,
- 0, 1, 0,
+ 0, 1, "",
"Make the frame FRAME visible (assuming it is an X-window).\n\
Also raises the frame so that nothing obscures it.\n\
If omitted, FRAME defaults to the currently selected frame.")
CHECK_LIVE_FRAME (frame, 0);
+ /* Don't let the frame remain selected. */
+ if (XFRAME (frame) == selected_frame)
+ Fhandle_switch_frame (next_frame (frame, Qt), Qnil);
+
+ /* Don't allow minibuf_window to remain on a deleted frame. */
+ if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window))
+ {
+ Fset_window_buffer (selected_frame->minibuffer_window,
+ XWINDOW (minibuf_window)->buffer);
+ minibuf_window = selected_frame->minibuffer_window;
+ }
+
/* I think this should be done with a hook. */
#ifdef HAVE_X_WINDOWS
if (FRAME_X_P (XFRAME (frame)))
CHECK_LIVE_FRAME (frame, 0);
+ /* Don't let the frame remain selected. */
+ if (XFRAME (frame) == selected_frame)
+ Fhandle_switch_frame (next_frame (frame, Qt), Qnil);
+
+ /* Don't allow minibuf_window to remain on a deleted frame. */
+ if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window))
+ {
+ Fset_window_buffer (selected_frame->minibuffer_window,
+ XWINDOW (minibuf_window)->buffer);
+ minibuf_window = selected_frame->minibuffer_window;
+ }
+
/* I think this should be done with a hook. */
#ifdef HAVE_X_WINDOWS
if (FRAME_X_P (XFRAME (frame)))
(frame, focus_frame)
Lisp_Object frame, focus_frame;
{
- CHECK_LIVE_FRAME (frame, 0);
+ /* Note that we don't check for a live frame here. It's reasonable
+ to redirect the focus of a frame you're about to delete, if you
+ know what other frame should receive those keystrokes. */
+ CHECK_FRAME (frame, 0);
if (! NILP (focus_frame))
CHECK_LIVE_FRAME (focus_frame, 1);
XFRAME (frame)->focus_frame = focus_frame;
+ /* I think this should be done with a hook. */
+#ifdef HAVE_X_WINDOWS
+ if (!NILP (focus_frame) && ! EQ (focus_frame, frame)
+ && FRAME_X_P (XFRAME (focus_frame)))
+ Ffocus_frame (focus_frame);
+#endif
+
if (frame_rehighlight_hook)
(*frame_rehighlight_hook) ();
error ("Surrogate minibuffer windows must be minibuffer windows.");
if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
- error ("Can't change the surrogate minibuffer of a frame with its own minibuffer.");
+ 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;
DEFUN ("frame-pixel-height", Fframe_pixel_height,
Sframe_pixel_height, 0, 1, 0,
- "Return a FRAME's heightin pixels.\n\
-For a terminal frame, the result really gives the sizes in characters.\n\
+ "Return a FRAME's height in pixels.\n\
+For a terminal frame, the result really gives the height in characters.\n\
If FRAME is omitted, the selected frame is used.")
(frame)
Lisp_Object frame;
DEFUN ("frame-pixel-width", Fframe_pixel_width,
Sframe_pixel_width, 0, 1, 0,
"Return FRAME's width in pixels.\n\
-For a terminal frame, the result really gives the sizes in characters.\n\
+For a terminal frame, the result really gives the width in characters.\n\
If FRAME is omitted, the selected frame is used.")
(frame)
Lisp_Object frame;
return Qt;
}
-\f
-#ifndef HAVE_X11
-DEFUN ("rubber-band-rectangle", Frubber_band_rectangle, Srubber_band_rectangle,
- 3, 3, "",
- "Ask user to specify a window position and size on FRAME with the mouse.\n\
-Arguments are FRAME, NAME and GEO. NAME is a name to be displayed as\n\
-the purpose of this rectangle. GEO is an X-windows size spec that can\n\
-specify defaults for some sizes/positions. If GEO specifies everything,\n\
-the mouse is not used.\n\
-Returns a list of five values: (FRAME LEFT TOP WIDTH HEIGHT).")
- (frame, name, geo)
- Lisp_Object frame;
- Lisp_Object name;
- Lisp_Object geo;
-{
- int vals[4];
- Lisp_Object nums[4];
- int i;
-
- CHECK_FRAME (frame, 0);
- CHECK_STRING (name, 1);
- CHECK_STRING (geo, 2);
-
- switch (XFRAME (frame)->output_method)
- {
- case output_x_window:
- x_rubber_band (XFRAME (frame), &vals[0], &vals[1], &vals[2], &vals[3],
- XSTRING (geo)->data, XSTRING (name)->data);
- break;
-
- default:
- return Qnil;
- }
-
- for (i = 0; i < 4; i++)
- XFASTINT (nums[i]) = vals[i];
- return Fcons (frame, Flist (4, nums));
- return Qnil;
-}
-#endif /* not HAVE_X11 */
\f
choose_minibuf_frame ()
{
defsubr (&Sset_frame_width);
defsubr (&Sset_frame_size);
defsubr (&Sset_frame_position);
-#ifndef HAVE_X11
- defsubr (&Srubber_band_rectangle);
-#endif /* HAVE_X11 */
}
keys_of_frame ()
XFASTINT (tem) = 0;
return tem;
}
+DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
+ "Return non-nil if OBJECT is a frame.\n\
+Value is t for a termcap frame (a character-only terminal),\n\
+`x' for an Emacs frame that is really an X window.\n\
+Also see `live-frame-p'.")
+ (object)
+ Lisp_Object object;
+{
+ return Qnil;
+}
DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
"Specify that the frame FRAME has LINES lines.\n\
syms_of_frame ()
{
defsubr (&Sselected_frame);
+ defsubr (&Sframep);
defsubr (&Sframe_char_height);
defsubr (&Sframe_char_width);
defsubr (&Sframe_pixel_height);