aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-08-14 08:07:14 +0400
committerDmitry Antipov2013-08-14 08:07:14 +0400
commit38a2c91021a5d5405438ba291b60f7ccdaa99862 (patch)
tree3d5a8faf87763e8ccc3389881284a23c85da7cbd /src
parentaf79c3cb0b5ac53484ffc8a39894d475527a2e8a (diff)
downloademacs-38a2c91021a5d5405438ba291b60f7ccdaa99862.tar.gz
emacs-38a2c91021a5d5405438ba291b60f7ccdaa99862.zip
* window.h (struct window): Convert scroll_bar_width
from Lisp_Object to integer. Adjust comment. (WINDOW_CONFIG_SCROLL_BAR_WIDTH, WINDOW_CONFIG_SCROLL_BAR_COLS): Adjust users. * window.c (wset_scroll_bar_width): Remove. (make_window): Initialize scroll_bar_width. (Fsplit_window_internal): Use direct assignment. (Fset_window_configuration, save_window_save): Convert Lisp_Object to integer and back where appropriate. (Fset_window_scroll_bars): Adjust user. Return t if any scroll bar was actually changed, and mention this in docstring.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/window.c34
-rw-r--r--src/window.h15
3 files changed, 36 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d89f702a2aa..7081236ec65 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12013-08-14 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * window.h (struct window): Convert scroll_bar_width
4 from Lisp_Object to integer. Adjust comment.
5 (WINDOW_CONFIG_SCROLL_BAR_WIDTH, WINDOW_CONFIG_SCROLL_BAR_COLS):
6 Adjust users.
7 * window.c (wset_scroll_bar_width): Remove.
8 (make_window): Initialize scroll_bar_width.
9 (Fsplit_window_internal): Use direct assignment.
10 (Fset_window_configuration, save_window_save):
11 Convert Lisp_Object to integer and back where appropriate.
12 (Fset_window_scroll_bars): Adjust user. Return t if any scroll
13 bar was actually changed, and mention this in docstring.
14
12013-08-13 Paul Eggert <eggert@cs.ucla.edu> 152013-08-13 Paul Eggert <eggert@cs.ucla.edu>
2 16
3 * decompress.c: Minor simplifications. 17 * decompress.c: Minor simplifications.
diff --git a/src/window.c b/src/window.c
index f9084e6c05f..7b2e9b08881 100644
--- a/src/window.c
+++ b/src/window.c
@@ -181,11 +181,6 @@ wset_pointm (struct window *w, Lisp_Object val)
181 w->pointm = val; 181 w->pointm = val;
182} 182}
183static void 183static void
184wset_scroll_bar_width (struct window *w, Lisp_Object val)
185{
186 w->scroll_bar_width = val;
187}
188static void
189wset_start (struct window *w, Lisp_Object val) 184wset_start (struct window *w, Lisp_Object val)
190{ 185{
191 w->start = val; 186 w->start = val;
@@ -3461,6 +3456,7 @@ make_window (void)
3461 w->left_fringe_width = w->right_fringe_width = -1; 3456 w->left_fringe_width = w->right_fringe_width = -1;
3462 w->phys_cursor_type = -1; 3457 w->phys_cursor_type = -1;
3463 w->phys_cursor_width = -1; 3458 w->phys_cursor_width = -1;
3459 w->scroll_bar_width = -1;
3464 w->column_number_displayed = -1; 3460 w->column_number_displayed = -1;
3465 3461
3466 /* Reset window_list. */ 3462 /* Reset window_list. */
@@ -3931,7 +3927,7 @@ set correctly. See the code of `split-window' for how this is done. */)
3931 n->left_fringe_width = r->left_fringe_width; 3927 n->left_fringe_width = r->left_fringe_width;
3932 n->right_fringe_width = r->right_fringe_width; 3928 n->right_fringe_width = r->right_fringe_width;
3933 n->fringes_outside_margins = r->fringes_outside_margins; 3929 n->fringes_outside_margins = r->fringes_outside_margins;
3934 wset_scroll_bar_width (n, r->scroll_bar_width); 3930 n->scroll_bar_width = r->scroll_bar_width;
3935 wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type); 3931 wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type);
3936 3932
3937 /* Directly assign orthogonal coordinates and sizes. */ 3933 /* Directly assign orthogonal coordinates and sizes. */
@@ -5674,7 +5670,7 @@ the return value is nil. Otherwise the value is t. */)
5674 w->left_fringe_width = XINT (p->left_fringe_width); 5670 w->left_fringe_width = XINT (p->left_fringe_width);
5675 w->right_fringe_width = XINT (p->right_fringe_width); 5671 w->right_fringe_width = XINT (p->right_fringe_width);
5676 w->fringes_outside_margins = !NILP (p->fringes_outside_margins); 5672 w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
5677 wset_scroll_bar_width (w, p->scroll_bar_width); 5673 w->scroll_bar_width = XINT (p->scroll_bar_width);
5678 wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type); 5674 wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
5679 wset_dedicated (w, p->dedicated); 5675 wset_dedicated (w, p->dedicated);
5680 wset_combination_limit (w, p->combination_limit); 5676 wset_combination_limit (w, p->combination_limit);
@@ -5975,7 +5971,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5975 p->left_fringe_width = make_number (w->left_fringe_width); 5971 p->left_fringe_width = make_number (w->left_fringe_width);
5976 p->right_fringe_width = make_number (w->right_fringe_width); 5972 p->right_fringe_width = make_number (w->right_fringe_width);
5977 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil; 5973 p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
5978 p->scroll_bar_width = w->scroll_bar_width; 5974 p->scroll_bar_width = make_number (w->scroll_bar_width);
5979 p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; 5975 p->vertical_scroll_bar_type = w->vertical_scroll_bar_type;
5980 p->dedicated = w->dedicated; 5976 p->dedicated = w->dedicated;
5981 p->combination_limit = w->combination_limit; 5977 p->combination_limit = w->combination_limit;
@@ -6263,18 +6259,17 @@ Third parameter VERTICAL-TYPE specifies the type of the vertical scroll
6263bar: left, right, or nil. 6259bar: left, right, or nil.
6264If WIDTH is nil, use the frame's scroll-bar width. 6260If WIDTH is nil, use the frame's scroll-bar width.
6265If VERTICAL-TYPE is t, use the frame's scroll-bar type. 6261If VERTICAL-TYPE is t, use the frame's scroll-bar type.
6266Fourth parameter HORIZONTAL-TYPE is currently unused. */) 6262Fourth parameter HORIZONTAL-TYPE is currently unused.
6267 (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) 6263
6264Return t if scroll bars was actually changed and nil otherwise. */)
6265 (Lisp_Object window, Lisp_Object width,
6266 Lisp_Object vertical_type, Lisp_Object horizontal_type)
6268{ 6267{
6269 struct window *w = decode_live_window (window); 6268 struct window *w = decode_live_window (window);
6269 int iwidth = (NILP (width) ? -1 : (CHECK_NATNUM (width), XINT (width)));
6270 6270
6271 if (!NILP (width)) 6271 if (iwidth == 0)
6272 { 6272 vertical_type = Qnil;
6273 CHECK_RANGED_INTEGER (width, 0, INT_MAX);
6274
6275 if (XINT (width) == 0)
6276 vertical_type = Qnil;
6277 }
6278 6273
6279 if (!(NILP (vertical_type) 6274 if (!(NILP (vertical_type)
6280 || EQ (vertical_type, Qleft) 6275 || EQ (vertical_type, Qleft)
@@ -6282,10 +6277,10 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6282 || EQ (vertical_type, Qt))) 6277 || EQ (vertical_type, Qt)))
6283 error ("Invalid type of vertical scroll bar"); 6278 error ("Invalid type of vertical scroll bar");
6284 6279
6285 if (!EQ (w->scroll_bar_width, width) 6280 if (w->scroll_bar_width != iwidth
6286 || !EQ (w->vertical_scroll_bar_type, vertical_type)) 6281 || !EQ (w->vertical_scroll_bar_type, vertical_type))
6287 { 6282 {
6288 wset_scroll_bar_width (w, width); 6283 w->scroll_bar_width = iwidth;
6289 wset_vertical_scroll_bar_type (w, vertical_type); 6284 wset_vertical_scroll_bar_type (w, vertical_type);
6290 6285
6291 adjust_window_margins (w); 6286 adjust_window_margins (w);
@@ -6295,6 +6290,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6295 6290
6296 ++windows_or_buffers_changed; 6291 ++windows_or_buffers_changed;
6297 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6292 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
6293 return Qt;
6298 } 6294 }
6299 6295
6300 return Qnil; 6296 return Qnil;
diff --git a/src/window.h b/src/window.h
index 9d41a14cd23..823fe678c43 100644
--- a/src/window.h
+++ b/src/window.h
@@ -141,10 +141,6 @@ struct window
141 it yet, or if the frame doesn't have any scroll bars, this is nil. */ 141 it yet, or if the frame doesn't have any scroll bars, this is nil. */
142 Lisp_Object vertical_scroll_bar; 142 Lisp_Object vertical_scroll_bar;
143 143
144 /* Pixel width of scroll bars.
145 A value of nil or t means use frame values. */
146 Lisp_Object scroll_bar_width;
147
148 /* Type of vertical scroll bar. A value of nil means 144 /* Type of vertical scroll bar. A value of nil means
149 no scroll bar. A value of t means use frame value. */ 145 no scroll bar. A value of t means use frame value. */
150 Lisp_Object vertical_scroll_bar_type; 146 Lisp_Object vertical_scroll_bar_type;
@@ -269,6 +265,10 @@ struct window
269 int left_margin_cols; 265 int left_margin_cols;
270 int right_margin_cols; 266 int right_margin_cols;
271 267
268 /* Pixel width of scroll bars.
269 A value of -1 means use frame values. */
270 int scroll_bar_width;
271
272 /* Non-zero if this window is a minibuffer window. */ 272 /* Non-zero if this window is a minibuffer window. */
273 unsigned mini : 1; 273 unsigned mini : 1;
274 274
@@ -695,8 +695,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
695 nonzero. */ 695 nonzero. */
696 696
697#define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \ 697#define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \
698 (INTEGERP (w->scroll_bar_width) \ 698 (w->scroll_bar_width >= 0 ? w->scroll_bar_width \
699 ? XFASTINT (w->scroll_bar_width) \
700 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w))) 699 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w)))
701 700
702/* Width that a scroll bar in window W should have, if there is one. 701/* Width that a scroll bar in window W should have, if there is one.
@@ -704,8 +703,8 @@ wset_next_buffers (struct window *w, Lisp_Object val)
704 this is still nonzero. */ 703 this is still nonzero. */
705 704
706#define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \ 705#define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \
707 (INTEGERP (w->scroll_bar_width) \ 706 (w->scroll_bar_width >= 0 \
708 ? ((XFASTINT (w->scroll_bar_width) \ 707 ? ((w->scroll_bar_width \
709 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \ 708 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \
710 / WINDOW_FRAME_COLUMN_WIDTH (w)) \ 709 / WINDOW_FRAME_COLUMN_WIDTH (w)) \
711 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w))) 710 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w)))