aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2012-11-02 14:34:26 +0400
committerDmitry Antipov2012-11-02 14:34:26 +0400
commitb9e9df47f2886bb4b6b67aea8eeb0b015258a063 (patch)
tree0223e720b05e2fe607708a1658d0cbbd14f05e8f
parentc574bc3409143d0eb3aea1fe3161fac28de7e366 (diff)
downloademacs-b9e9df47f2886bb4b6b67aea8eeb0b015258a063.tar.gz
emacs-b9e9df47f2886bb4b6b67aea8eeb0b015258a063.zip
Window-related stuff cleanup here and there.
* dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p): Use decode_any_window. * fringe.c (Ffringe_bitmaps_at_pos): Likewise. * xdisp.c (Fformat_mode_line): Likewise. * font.c (Ffont_at): Use decode_live_window. * indent.c (Fcompute_motion, Fvertical_motion): Likewise. * window.c (decode_next_window_args): Likewise. (decode_any_window): Remove static. * window.h (decode_any_window): Add prototype. * lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here... * window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P, respectively.
-rw-r--r--src/ChangeLog16
-rw-r--r--src/dispnew.c20
-rw-r--r--src/font.c6
-rw-r--r--src/fringe.c6
-rw-r--r--src/indent.c15
-rw-r--r--src/lisp.h14
-rw-r--r--src/window.c9
-rw-r--r--src/window.h9
-rw-r--r--src/xdisp.c8
9 files changed, 39 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bcbc455dba6..25cb1e76fa5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,21 @@
12012-11-02 Dmitry Antipov <dmantipov@yandex.ru> 12012-11-02 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Window-related stuff cleanup here and there.
4 * dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p):
5 Use decode_any_window.
6 * fringe.c (Ffringe_bitmaps_at_pos): Likewise.
7 * xdisp.c (Fformat_mode_line): Likewise.
8 * font.c (Ffont_at): Use decode_live_window.
9 * indent.c (Fcompute_motion, Fvertical_motion): Likewise.
10 * window.c (decode_next_window_args): Likewise.
11 (decode_any_window): Remove static.
12 * window.h (decode_any_window): Add prototype.
13 * lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here...
14 * window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P,
15 respectively.
16
172012-11-02 Dmitry Antipov <dmantipov@yandex.ru>
18
3 Remove pad from struct input_event. 19 Remove pad from struct input_event.
4 * termhooks.h (struct input_event): Remove padding field. 20 * termhooks.h (struct input_event): Remove padding field.
5 Adjust comment. 21 Adjust comment.
diff --git a/src/dispnew.c b/src/dispnew.c
index 9f0e22fcdcb..e99387d2f6e 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6375,15 +6375,7 @@ don't show a cursor. */)
6375 /* Don't change cursor state while redisplaying. This could confuse 6375 /* Don't change cursor state while redisplaying. This could confuse
6376 output routines. */ 6376 output routines. */
6377 if (!redisplaying_p) 6377 if (!redisplaying_p)
6378 { 6378 decode_any_window (window)->cursor_off_p = NILP (show);
6379 if (NILP (window))
6380 window = selected_window;
6381 else
6382 CHECK_WINDOW (window);
6383
6384 XWINDOW (window)->cursor_off_p = NILP (show);
6385 }
6386
6387 return Qnil; 6379 return Qnil;
6388} 6380}
6389 6381
@@ -6394,15 +6386,7 @@ DEFUN ("internal-show-cursor-p", Finternal_show_cursor_p,
6394WINDOW nil or omitted means report on the selected window. */) 6386WINDOW nil or omitted means report on the selected window. */)
6395 (Lisp_Object window) 6387 (Lisp_Object window)
6396{ 6388{
6397 struct window *w; 6389 return decode_any_window (window)->cursor_off_p ? Qnil : Qt;
6398
6399 if (NILP (window))
6400 window = selected_window;
6401 else
6402 CHECK_WINDOW (window);
6403
6404 w = XWINDOW (window);
6405 return w->cursor_off_p ? Qnil : Qt;
6406} 6390}
6407 6391
6408DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame, 6392DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame,
diff --git a/src/font.c b/src/font.c
index e79ce5d80bc..87932b0e440 100644
--- a/src/font.c
+++ b/src/font.c
@@ -4765,13 +4765,9 @@ Optional third arg STRING, if non-nil, is a string containing the target
4765character at index specified by POSITION. */) 4765character at index specified by POSITION. */)
4766 (Lisp_Object position, Lisp_Object window, Lisp_Object string) 4766 (Lisp_Object position, Lisp_Object window, Lisp_Object string)
4767{ 4767{
4768 struct window *w; 4768 struct window *w = decode_live_window (window);
4769 ptrdiff_t pos; 4769 ptrdiff_t pos;
4770 4770
4771 if (NILP (window))
4772 window = selected_window;
4773 CHECK_LIVE_WINDOW (window);
4774 w = XWINDOW (window);
4775 if (NILP (string)) 4771 if (NILP (string))
4776 { 4772 {
4777 if (XBUFFER (w->buffer) != current_buffer) 4773 if (XBUFFER (w->buffer) != current_buffer)
diff --git a/src/fringe.c b/src/fringe.c
index d788503e91e..a126292e1ff 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1731,10 +1731,8 @@ Return nil if POS is not visible in WINDOW. */)
1731 struct glyph_row *row; 1731 struct glyph_row *row;
1732 ptrdiff_t textpos; 1732 ptrdiff_t textpos;
1733 1733
1734 if (NILP (window)) 1734 w = decode_any_window (window);
1735 window = selected_window; 1735 XSETWINDOW (window, w);
1736 CHECK_WINDOW (window);
1737 w = XWINDOW (window);
1738 1736
1739 if (!NILP (pos)) 1737 if (!NILP (pos))
1740 { 1738 {
diff --git a/src/indent.c b/src/indent.c
index bbc944d2518..eee96061e25 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1764,11 +1764,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1764 else 1764 else
1765 hscroll = tab_offset = 0; 1765 hscroll = tab_offset = 0;
1766 1766
1767 if (NILP (window)) 1767 w = decode_live_window (window);
1768 window = Fselected_window ();
1769 else
1770 CHECK_LIVE_WINDOW (window);
1771 w = XWINDOW (window);
1772 1768
1773 if (XINT (from) < BEGV || XINT (from) > ZV) 1769 if (XINT (from) < BEGV || XINT (from) > ZV)
1774 args_out_of_range_3 (from, make_number (BEGV), make_number (ZV)); 1770 args_out_of_range_3 (from, make_number (BEGV), make_number (ZV));
@@ -1790,8 +1786,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1790 1)) 1786 1))
1791 : XINT (XCAR (topos))), 1787 : XINT (XCAR (topos))),
1792 (NILP (width) ? -1 : XINT (width)), 1788 (NILP (width) ? -1 : XINT (width)),
1793 hscroll, tab_offset, 1789 hscroll, tab_offset, w);
1794 XWINDOW (window));
1795 1790
1796 XSETFASTINT (bufpos, pos->bufpos); 1791 XSETFASTINT (bufpos, pos->bufpos);
1797 XSETINT (hpos, pos->hpos); 1792 XSETINT (hpos, pos->hpos);
@@ -1988,11 +1983,7 @@ whether or not it is currently displayed in some window. */)
1988 } 1983 }
1989 1984
1990 CHECK_NUMBER (lines); 1985 CHECK_NUMBER (lines);
1991 if (! NILP (window)) 1986 w = decode_live_window (window);
1992 CHECK_WINDOW (window);
1993 else
1994 window = selected_window;
1995 w = XWINDOW (window);
1996 1987
1997 old_buffer = Qnil; 1988 old_buffer = Qnil;
1998 GCPRO3 (old_buffer, old_charpos, old_bytepos); 1989 GCPRO3 (old_buffer, old_charpos, old_bytepos);
diff --git a/src/lisp.h b/src/lisp.h
index 3ec188b67c7..61671bdaf21 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1791,20 +1791,6 @@ typedef struct {
1791#define CHECK_WINDOW_CONFIGURATION(x) \ 1791#define CHECK_WINDOW_CONFIGURATION(x) \
1792 CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x) 1792 CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
1793 1793
1794/* A window of any sort, leaf or interior, is "valid" if one of its
1795 buffer, vchild, or hchild members is non-nil. */
1796#define CHECK_VALID_WINDOW(x) \
1797 CHECK_TYPE (WINDOWP (x) \
1798 && (!NILP (XWINDOW (x)->buffer) \
1799 || !NILP (XWINDOW (x)->vchild) \
1800 || !NILP (XWINDOW (x)->hchild)), \
1801 Qwindow_valid_p, x)
1802
1803/* A window is "live" if and only if it shows a buffer. */
1804#define CHECK_LIVE_WINDOW(x) \
1805 CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \
1806 Qwindow_live_p, x)
1807
1808#define CHECK_PROCESS(x) \ 1794#define CHECK_PROCESS(x) \
1809 CHECK_TYPE (PROCESSP (x), Qprocessp, x) 1795 CHECK_TYPE (PROCESSP (x), Qprocessp, x)
1810 1796
diff --git a/src/window.c b/src/window.c
index dfcabda59b9..8dbecf9c81e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -244,7 +244,7 @@ decode_live_window (register Lisp_Object window)
244 return XWINDOW (window); 244 return XWINDOW (window);
245} 245}
246 246
247static struct window * 247struct window *
248decode_any_window (register Lisp_Object window) 248decode_any_window (register Lisp_Object window)
249{ 249{
250 struct window *w; 250 struct window *w;
@@ -2252,10 +2252,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
2252static void 2252static void
2253decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames) 2253decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames)
2254{ 2254{
2255 if (NILP (*window)) 2255 struct window *w = decode_live_window (*window);
2256 *window = selected_window;
2257 else
2258 CHECK_LIVE_WINDOW (*window);
2259 2256
2260 /* MINIBUF nil may or may not include minibuffers. Decide if it 2257 /* MINIBUF nil may or may not include minibuffers. Decide if it
2261 does. */ 2258 does. */
@@ -2272,7 +2269,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
2272 if (NILP (*all_frames)) 2269 if (NILP (*all_frames))
2273 *all_frames 2270 *all_frames
2274 = (!EQ (*minibuf, Qlambda) 2271 = (!EQ (*minibuf, Qlambda)
2275 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) 2272 ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame))
2276 : Qnil); 2273 : Qnil);
2277 else if (EQ (*all_frames, Qvisible)) 2274 else if (EQ (*all_frames, Qvisible))
2278 ; 2275 ;
diff --git a/src/window.h b/src/window.h
index 115b361194c..2a12226c0aa 100644
--- a/src/window.h
+++ b/src/window.h
@@ -970,17 +970,26 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
970 || !NILP (XWINDOW (WINDOW)->vchild) \ 970 || !NILP (XWINDOW (WINDOW)->vchild) \
971 || !NILP (XWINDOW (WINDOW)->hchild))) 971 || !NILP (XWINDOW (WINDOW)->hchild)))
972 972
973/* A window of any sort, leaf or interior, is "valid" if one
974 of its buffer, vchild, or hchild members is non-nil. */
975#define CHECK_VALID_WINDOW(WINDOW) \
976 CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW)
973 977
974/* Value is non-zero if WINDOW is a live window. */ 978/* Value is non-zero if WINDOW is a live window. */
975#define WINDOW_LIVE_P(WINDOW) \ 979#define WINDOW_LIVE_P(WINDOW) \
976 (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) 980 (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer))
977 981
982/* A window is "live" if and only if it shows a buffer. */
983#define CHECK_LIVE_WINDOW(WINDOW) \
984 CHECK_TYPE (WINDOW_LIVE_P (WINDOW), Qwindow_live_p, WINDOW)
985
978/* These used to be in lisp.h. */ 986/* These used to be in lisp.h. */
979 987
980extern Lisp_Object Qwindowp, Qwindow_live_p; 988extern Lisp_Object Qwindowp, Qwindow_live_p;
981extern Lisp_Object Vwindow_list; 989extern Lisp_Object Vwindow_list;
982 990
983extern struct window *decode_live_window (Lisp_Object); 991extern struct window *decode_live_window (Lisp_Object);
992extern struct window *decode_any_window (Lisp_Object);
984extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool); 993extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);
985extern void mark_window_cursors_off (struct window *); 994extern void mark_window_cursors_off (struct window *);
986extern int window_internal_height (struct window *); 995extern int window_internal_height (struct window *);
diff --git a/src/xdisp.c b/src/xdisp.c
index b3b08edcd0a..b235f92edfe 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21018,10 +21018,8 @@ are the selected window and the WINDOW's buffer). */)
21018 Lisp_Object str; 21018 Lisp_Object str;
21019 int string_start = 0; 21019 int string_start = 0;
21020 21020
21021 if (NILP (window)) 21021 w = decode_any_window (window);
21022 window = selected_window; 21022 XSETWINDOW (window, w);
21023 CHECK_WINDOW (window);
21024 w = XWINDOW (window);
21025 21023
21026 if (NILP (buffer)) 21024 if (NILP (buffer))
21027 buffer = w->buffer; 21025 buffer = w->buffer;
@@ -21050,7 +21048,7 @@ are the selected window and the WINDOW's buffer). */)
21050 and set that to nil so that we don't alter the outer value. */ 21048 and set that to nil so that we don't alter the outer value. */
21051 record_unwind_protect (unwind_format_mode_line, 21049 record_unwind_protect (unwind_format_mode_line,
21052 format_mode_line_unwind_data 21050 format_mode_line_unwind_data
21053 (XFRAME (WINDOW_FRAME (XWINDOW (window))), 21051 (XFRAME (WINDOW_FRAME (w)),
21054 old_buffer, selected_window, 1)); 21052 old_buffer, selected_window, 1));
21055 mode_line_proptrans_alist = Qnil; 21053 mode_line_proptrans_alist = Qnil;
21056 21054