Commit 727e958e authored by Martin Rudalics's avatar Martin Rudalics

Move some window-related functions from frame.c to window.c.

* lisp.h: Move EXFUNS for Fframe_root_window,
Fframe_first_window and Fset_frame_selected_window to window.h.

* window.h: Move EXFUNS for Fframe_root_window,
Fframe_first_window and Fset_frame_selected_window here from
lisp.h.

* frame.c (Fwindow_frame, Fframe_first_window)
(Fframe_root_window, Fframe_selected_window)
(Fset_frame_selected_window): Move to window.c.
(Factive_minibuffer_window): Move to minibuf.c.
(Fother_visible_frames_p): New function.

* minibuf.c (Factive_minibuffer_window): Move here from frame.c.

* window.c (Fwindow_frame): Move here from frame.c.  Accept any
window as argument.
(Fframe_root_window, Fframe_first_window)
(Fframe_selected_window): Move here from frame.c.  Accept frame
or arbitrary window as argument.  Update doc-strings.
(Fminibuffer_window): Move up in code.
(Fwindow_minibuffer_p): Move up in code and simplify.
(Fset_frame_selected_window): Move here from frame.c.  Marginal
rewrite.
(Fselected_window, select_window, Fselect_window): Move up in
code.  Minor doc-string fixes.
parent bf60a96b
2011-06-06 Martin Rudalics <rudalics@gmx.at> 2011-06-06 Martin Rudalics <rudalics@gmx.at>
* lisp.h: Move EXFUNS for Fframe_root_window,
Fframe_first_window and Fset_frame_selected_window to window.h.
* window.h: Move EXFUNS for Fframe_root_window,
Fframe_first_window and Fset_frame_selected_window here from
lisp.h.
* frame.c (Fwindow_frame, Fframe_first_window)
(Fframe_root_window, Fframe_selected_window)
(Fset_frame_selected_window): Move to window.c.
(Factive_minibuffer_window): Move to minibuf.c.
(Fother_visible_frames_p): New function.
* minibuf.c (Factive_minibuffer_window): Move here from frame.c.
* window.c (decode_window, decode_any_window): Move up in code. * window.c (decode_window, decode_any_window): Move up in code.
(Fwindowp, Fwindow_live_p): Rewrite doc-strings. (Fwindowp, Fwindow_live_p): Rewrite doc-strings.
(inhibit_frame_unsplittable): Remove unused variable. (inhibit_frame_unsplittable): Remove unused variable.
(Fwindow_buffer): Move up and rewrite doc-string. (Fwindow_buffer): Move up and rewrite doc-string.
(Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next) (Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next)
(Fwindow_prev): New functions. (Fwindow_prev): New functions.
(Fwindow_frame): Move here from frame.c. Accept any window as
argument.
(Fframe_root_window, Fframe_first_window)
(Fframe_selected_window): Move here from frame.c. Accept frame
or arbitrary window as argument. Update doc-strings.
(Fminibuffer_window): Move up in code.
(Fwindow_minibuffer_p): Move up in code and simplify.
(Fset_frame_selected_window): Move here from frame.c. Marginal
rewrite.
(Fselected_window, select_window, Fselect_window): Move up in
code. Minor doc-string fixes.
2011-06-06 Paul Eggert <eggert@cs.ucla.edu> 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
......
...@@ -903,111 +903,6 @@ DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0, ...@@ -903,111 +903,6 @@ DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
{ {
return selected_frame; return selected_frame;
} }
DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
doc: /* Return the frame object that window WINDOW is on. */)
(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. */)
(Lisp_Object frame)
{
Lisp_Object w;
if (NILP (frame))
w = SELECTED_FRAME ()->root_window;
else
{
CHECK_LIVE_FRAME (frame);
w = XFRAME (frame)->root_window;
}
while (NILP (XWINDOW (w)->buffer))
{
if (! NILP (XWINDOW (w)->hchild))
w = XWINDOW (w)->hchild;
else if (! NILP (XWINDOW (w)->vchild))
w = XWINDOW (w)->vchild;
else
abort ();
}
return 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. */)
(Lisp_Object frame)
{
Lisp_Object window;
if (NILP (frame))
window = SELECTED_FRAME ()->root_window;
else
{
CHECK_LIVE_FRAME (frame);
window = XFRAME (frame)->root_window;
}
return window;
}
DEFUN ("frame-selected-window", Fframe_selected_window,
Sframe_selected_window, 0, 1, 0,
doc: /* Return the selected window of FRAME.
FRAME defaults to the currently selected frame. */)
(Lisp_Object frame)
{
Lisp_Object window;
if (NILP (frame))
window = SELECTED_FRAME ()->selected_window;
else
{
CHECK_LIVE_FRAME (frame);
window = XFRAME (frame)->selected_window;
}
return window;
}
DEFUN ("set-frame-selected-window", Fset_frame_selected_window,
Sset_frame_selected_window, 2, 3, 0,
doc: /* Set selected window of FRAME to WINDOW.
If FRAME is nil, use the selected frame. If FRAME is the
selected frame, this makes WINDOW the selected window.
Optional argument NORECORD non-nil means to neither change the
order of recently selected windows nor the buffer list.
Return WINDOW. */)
(Lisp_Object frame, Lisp_Object window, Lisp_Object norecord)
{
if (NILP (frame))
frame = selected_frame;
CHECK_LIVE_FRAME (frame);
CHECK_LIVE_WINDOW (window);
if (! EQ (frame, WINDOW_FRAME (XWINDOW (window))))
error ("In `set-frame-selected-window', WINDOW is not on FRAME");
if (EQ (frame, selected_frame))
return Fselect_window (window, norecord);
return XFRAME (frame)->selected_window = window;
}
DEFUN ("frame-list", Fframe_list, Sframe_list, DEFUN ("frame-list", Fframe_list, Sframe_list,
0, 0, 0, 0, 0, 0,
...@@ -1265,6 +1160,17 @@ other_visible_frames (FRAME_PTR f) ...@@ -1265,6 +1160,17 @@ other_visible_frames (FRAME_PTR f)
return 1; return 1;
} }
DEFUN ("other-visible-frames-p", Fother_visible_frames_p, Sother_visible_frames_p, 0, 1, 0,
doc: /* Return t if there are other visible frames beside FRAME.
FRAME defaults to the selected frame. */)
(Lisp_Object frame)
{
if (NILP (frame))
frame = selected_frame;
CHECK_LIVE_FRAME (frame);
return other_visible_frames (XFRAME (frame)) ? Qt : Qnil;
}
/* Delete FRAME. When FORCE equals Qnoelisp, delete FRAME /* Delete FRAME. When FORCE equals Qnoelisp, delete FRAME
unconditionally. x_connection_closed and delete_terminal use unconditionally. x_connection_closed and delete_terminal use
this. Any other value of FORCE implements the semantics this. Any other value of FORCE implements the semantics
...@@ -4605,7 +4511,6 @@ automatically. See also `mouse-autoselect-window'. */); ...@@ -4605,7 +4511,6 @@ automatically. See also `mouse-autoselect-window'. */);
staticpro (&Vframe_list); staticpro (&Vframe_list);
defsubr (&Sactive_minibuffer_window);
defsubr (&Sframep); defsubr (&Sframep);
defsubr (&Sframe_live_p); defsubr (&Sframe_live_p);
defsubr (&Swindow_system); defsubr (&Swindow_system);
...@@ -4613,14 +4518,10 @@ automatically. See also `mouse-autoselect-window'. */); ...@@ -4613,14 +4518,10 @@ automatically. See also `mouse-autoselect-window'. */);
defsubr (&Shandle_switch_frame); defsubr (&Shandle_switch_frame);
defsubr (&Sselect_frame); defsubr (&Sselect_frame);
defsubr (&Sselected_frame); defsubr (&Sselected_frame);
defsubr (&Swindow_frame);
defsubr (&Sframe_root_window);
defsubr (&Sframe_first_window);
defsubr (&Sframe_selected_window);
defsubr (&Sset_frame_selected_window);
defsubr (&Sframe_list); defsubr (&Sframe_list);
defsubr (&Snext_frame); defsubr (&Snext_frame);
defsubr (&Sprevious_frame); defsubr (&Sprevious_frame);
defsubr (&Sother_visible_frames_p);
defsubr (&Sdelete_frame); defsubr (&Sdelete_frame);
defsubr (&Smouse_position); defsubr (&Smouse_position);
defsubr (&Smouse_pixel_position); defsubr (&Smouse_pixel_position);
......
...@@ -3181,16 +3181,12 @@ extern Lisp_Object get_frame_param (struct frame *, Lisp_Object); ...@@ -3181,16 +3181,12 @@ extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
extern Lisp_Object frame_buffer_predicate (Lisp_Object); extern Lisp_Object frame_buffer_predicate (Lisp_Object);
EXFUN (Fselect_frame, 2); EXFUN (Fselect_frame, 2);
EXFUN (Fselected_frame, 0); EXFUN (Fselected_frame, 0);
EXFUN (Fwindow_frame, 1);
EXFUN (Fframe_root_window, 1);
EXFUN (Fframe_first_window, 1);
EXFUN (Fmake_frame_visible, 1); EXFUN (Fmake_frame_visible, 1);
EXFUN (Ficonify_frame, 1); EXFUN (Ficonify_frame, 1);
EXFUN (Fframe_parameter, 2); EXFUN (Fframe_parameter, 2);
EXFUN (Fmodify_frame_parameters, 2); EXFUN (Fmodify_frame_parameters, 2);
EXFUN (Fraise_frame, 1); EXFUN (Fraise_frame, 1);
EXFUN (Fredirect_frame_focus, 2); EXFUN (Fredirect_frame_focus, 2);
EXFUN (Fset_frame_selected_window, 3);
extern Lisp_Object frame_buffer_list (Lisp_Object); extern Lisp_Object frame_buffer_list (Lisp_Object);
extern void frames_discard_buffer (Lisp_Object); extern void frames_discard_buffer (Lisp_Object);
extern void set_frame_buffer_list (Lisp_Object, Lisp_Object); extern void set_frame_buffer_list (Lisp_Object, Lisp_Object);
......
...@@ -143,6 +143,14 @@ choose_minibuf_frame_1 (Lisp_Object ignore) ...@@ -143,6 +143,14 @@ choose_minibuf_frame_1 (Lisp_Object ignore)
return Qnil; return Qnil;
} }
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 ("set-minibuffer-window", Fset_minibuffer_window, DEFUN ("set-minibuffer-window", Fset_minibuffer_window,
Sset_minibuffer_window, 1, 1, 0, Sset_minibuffer_window, 1, 1, 0,
doc: /* Specify which minibuffer window to use for the minibuffer. doc: /* Specify which minibuffer window to use for the minibuffer.
...@@ -2181,6 +2189,7 @@ properties. */); ...@@ -2181,6 +2189,7 @@ properties. */);
doc: /* Minibuffer keymap used for reading Lisp expressions. */); doc: /* Minibuffer keymap used for reading Lisp expressions. */);
Vread_expression_map = Qnil; Vread_expression_map = Qnil;
defsubr (&Sactive_minibuffer_window);
defsubr (&Sset_minibuffer_window); defsubr (&Sset_minibuffer_window);
defsubr (&Sread_from_minibuffer); defsubr (&Sread_from_minibuffer);
defsubr (&Seval_minibuffer); defsubr (&Seval_minibuffer);
......
This diff is collapsed.
...@@ -844,11 +844,14 @@ struct glyph *get_phys_cursor_glyph (struct window *w); ...@@ -844,11 +844,14 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
extern Lisp_Object Qwindowp, Qwindow_live_p; extern Lisp_Object Qwindowp, Qwindow_live_p;
extern Lisp_Object Vwindow_list; extern Lisp_Object Vwindow_list;
EXFUN (Fselected_window, 0);
EXFUN (Fwindow_minibuffer_p, 1);
EXFUN (Fdelete_window, 1);
EXFUN (Fwindow_buffer, 1); EXFUN (Fwindow_buffer, 1);
EXFUN (Fget_buffer_window, 2); EXFUN (Fget_buffer_window, 2);
EXFUN (Fwindow_minibuffer_p, 1);
EXFUN (Fselected_window, 0);
EXFUN (Fframe_root_window, 1);
EXFUN (Fframe_first_window, 1);
EXFUN (Fset_frame_selected_window, 3);
EXFUN (Fdelete_window, 1);
EXFUN (Fset_window_configuration, 1); EXFUN (Fset_window_configuration, 1);
EXFUN (Fcurrent_window_configuration, 1); EXFUN (Fcurrent_window_configuration, 1);
extern int compare_window_configurations (Lisp_Object, Lisp_Object, int); extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment