aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-11-06 17:26:20 +0400
committerDmitry Antipov2012-11-06 17:26:20 +0400
commitd9f07150fc320156377a172fd4a5ec23f13a15c0 (patch)
treed6f3d226cc337756df27d3c828e64d5b9e816132 /src/window.c
parent8e6a67b7fa719b0527bb66377d6b72c3c4e84142 (diff)
downloademacs-d9f07150fc320156377a172fd4a5ec23f13a15c0.tar.gz
emacs-d9f07150fc320156377a172fd4a5ec23f13a15c0.zip
Widely used frame validity and checking functions.
* frame.h (decode_live_frame, decode_any_frame): Add prototypes. * frame.c (decode_live_frame, decode_any_frame): New functions. (delete_frame, Fredirect_frame_focus, Fframe_parameters) (Fframe_parameter, Fframe_char_height, Fframe_char_width) (Fframe_pixel_height, Fframe_pixel_width, Ftool_bar_pixel_width) (Fframe_pointer_visible_p): Use decode_any_frame. (Fmake_frame_visible, Fmake_frame_invisible, Ficonify_frame) (Fraise_frame, Flower_frame, Fmodify_frame_parameters) (Fset_frame_height, Fset_frame_width): Use decode_live_frame. (Fframe_focus): Likewise. Allow zero number of arguments. Adjust docstring. (frame_buffer_list, frame_buffer_predicate): Remove. * lisp.h (frame_buffer_predicate): Remove prototype. * buffer.c (Fother_buffer): Use decode_any_frame. * xdisp.c (Ftool_bar_lines_needed): Likewise. * xfaces.c (Fcolor_gray_p, Fcolor_supported_p): Likewise. * font.c (Ffont_face_attributes, Ffont_family_list, Fopen_font) (Fclose_font, Ffont_info): Use decode_live_frame. * fontset.c (check_fontset_name): Likewise. * terminal.c (Fframe_terminal): Likewise. * w32fns.c (check_x_frame): Likewise. * window.c (Fminibuffer_window, Fwindow_at) (Fcurrent_window_configuration): Likewise. (Frun_window_configuration_change_hook, Fwindow_resize_apply): Likewise. Allow zero number of arguments. Adjust docstring. * dispnew.c (Fredraw_frame): Likewise. * xfaces.c (frame_or_selected_frame): Remove. (Fx_list_fonts, Finternal_get_lisp_face_attribute, Fface_font) (Finternal_lisp_face_equal_p, Finternal_lisp_face_empty_p) (Fframe_face_alist): Use decode_live_frame. * xfns.c (check_x_frame): Likewise.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/src/window.c b/src/window.c
index 75a8d42d8d1..c32234b5fcd 100644
--- a/src/window.c
+++ b/src/window.c
@@ -340,10 +340,7 @@ DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
340If FRAME is omitted or nil, it defaults to the selected frame. */) 340If FRAME is omitted or nil, it defaults to the selected frame. */)
341 (Lisp_Object frame) 341 (Lisp_Object frame)
342{ 342{
343 if (NILP (frame)) 343 return FRAME_MINIBUF_WINDOW (decode_live_frame (frame));
344 frame = selected_frame;
345 CHECK_LIVE_FRAME (frame);
346 return FRAME_MINIBUF_WINDOW (XFRAME (frame));
347} 344}
348 345
349DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 346DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p,
@@ -1371,12 +1368,7 @@ The top left corner of the frame is considered to be row 0,
1371column 0. */) 1368column 0. */)
1372 (Lisp_Object x, Lisp_Object y, Lisp_Object frame) 1369 (Lisp_Object x, Lisp_Object y, Lisp_Object frame)
1373{ 1370{
1374 struct frame *f; 1371 struct frame *f = decode_live_frame (frame);
1375
1376 if (NILP (frame))
1377 frame = selected_frame;
1378 CHECK_LIVE_FRAME (frame);
1379 f = XFRAME (frame);
1380 1372
1381 /* Check that arguments are integers or floats. */ 1373 /* Check that arguments are integers or floats. */
1382 CHECK_NUMBER_OR_FLOAT (x); 1374 CHECK_NUMBER_OR_FLOAT (x);
@@ -3109,12 +3101,12 @@ run_window_configuration_change_hook (struct frame *f)
3109} 3101}
3110 3102
3111DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, 3103DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook,
3112 Srun_window_configuration_change_hook, 1, 1, 0, 3104 Srun_window_configuration_change_hook, 0, 1, 0,
3113 doc: /* Run `window-configuration-change-hook' for FRAME. */) 3105 doc: /* Run `window-configuration-change-hook' for FRAME.
3106If FRAME is omitted or nil, it defaults to the selected frame. */)
3114 (Lisp_Object frame) 3107 (Lisp_Object frame)
3115{ 3108{
3116 CHECK_LIVE_FRAME (frame); 3109 run_window_configuration_change_hook (decode_live_frame (frame));
3117 run_window_configuration_change_hook (XFRAME (frame));
3118 return Qnil; 3110 return Qnil;
3119} 3111}
3120 3112
@@ -3641,10 +3633,12 @@ window_resize_apply (struct window *w, int horflag)
3641} 3633}
3642 3634
3643 3635
3644DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 1, 2, 0, 3636DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 0, 2, 0,
3645 doc: /* Apply requested size values for window-tree of FRAME. 3637 doc: /* Apply requested size values for window-tree of FRAME.
3646Optional argument HORIZONTAL omitted or nil means apply requested height 3638If FRAME is omitted or nil, it defaults to the selected frame.
3647values. HORIZONTAL non-nil means apply requested width values. 3639
3640Optional argument HORIZONTAL omitted or nil means apply requested
3641height values. HORIZONTAL non-nil means apply requested width values.
3648 3642
3649This function checks whether the requested values sum up to a valid 3643This function checks whether the requested values sum up to a valid
3650window layout, recursively assigns the new sizes of all child windows 3644window layout, recursively assigns the new sizes of all child windows
@@ -3655,17 +3649,10 @@ Note: This function does not check any of `window-fixed-size-p',
3655be applied on the Elisp level. */) 3649be applied on the Elisp level. */)
3656 (Lisp_Object frame, Lisp_Object horizontal) 3650 (Lisp_Object frame, Lisp_Object horizontal)
3657{ 3651{
3658 struct frame *f; 3652 struct frame *f = decode_live_frame (frame);
3659 struct window *r; 3653 struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f));
3660 int horflag = !NILP (horizontal); 3654 int horflag = !NILP (horizontal);
3661 3655
3662 if (NILP (frame))
3663 frame = selected_frame;
3664 CHECK_LIVE_FRAME (frame);
3665
3666 f = XFRAME (frame);
3667 r = XWINDOW (FRAME_ROOT_WINDOW (f));
3668
3669 if (!window_resize_check (r, horflag) 3656 if (!window_resize_check (r, horflag)
3670 || ! EQ (r->new_total, 3657 || ! EQ (r->new_total,
3671 (horflag ? r->total_cols : r->total_lines))) 3658 (horflag ? r->total_cols : r->total_lines)))
@@ -6148,12 +6135,7 @@ saved by this function. */)
6148 register int n_windows; 6135 register int n_windows;
6149 register struct save_window_data *data; 6136 register struct save_window_data *data;
6150 register int i; 6137 register int i;
6151 FRAME_PTR f; 6138 struct frame *f = decode_live_frame (frame);
6152
6153 if (NILP (frame))
6154 frame = selected_frame;
6155 CHECK_LIVE_FRAME (frame);
6156 f = XFRAME (frame);
6157 6139
6158 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); 6140 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
6159 data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols, 6141 data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols,