aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
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/window.c
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/window.c')
-rw-r--r--src/window.c34
1 files changed, 15 insertions, 19 deletions
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;