aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2014-01-02 16:58:48 +0100
committerMartin Rudalics2014-01-02 16:58:48 +0100
commit44c5e192bebd669e687423145cb4949567f64314 (patch)
tree87e71c3367932103e9921e385c24d22853d0e623 /src
parentc4377e925acc4d9beabc516501e2eef0400197de (diff)
downloademacs-44c5e192bebd669e687423145cb4949567f64314.tar.gz
emacs-44c5e192bebd669e687423145cb4949567f64314.zip
Further adjust frame/window scrollbar width calculations.
* window.c (apply_window_adjustment): Set windows_or_buffers_changed. (Fwindow_scroll_bars): Return actual scrollbar width. * xfns.c (x_set_scroll_bar_default_width): Rename wid to unit. For non-toolkit builds again use 14 as minimum width and set FRAME_CONFIG_SCROLL_BAR_WIDTH accordingly. * xterm.c (XTset_vertical_scroll_bar): Take width from WINDOW_SCROLL_BAR_AREA_WIDTH. (x_new_font): Rename wid to unit. Base calculation of new scrollbar width on toolkit used and make it analogous to that of x_set_scroll_bar_default_width. * w32fns.c (x_set_scroll_bar_default_width): Rename wid to unit. (Fx_create_frame): Call x_set_scroll_bar_default_width instead of GetSystemMetrics. * w32term.c (w32_set_vertical_scroll_bar): Take width from WINDOW_SCROLL_BAR_AREA_WIDTH. (x_new_font): Make it correspond to changes in xterm.c.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog21
-rw-r--r--src/frame.c2
-rw-r--r--src/w32fns.c8
-rw-r--r--src/w32term.c20
-rw-r--r--src/window.c5
-rw-r--r--src/xfns.c16
-rw-r--r--src/xterm.c32
7 files changed, 62 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1291815a4bc..325e428bfeb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,24 @@
12014-01-02 Martin Rudalics <rudalics@gmx.at>
2
3 Further adjust frame/window scrollbar width calculations.
4 * window.c (apply_window_adjustment): Set
5 windows_or_buffers_changed.
6 (Fwindow_scroll_bars): Return actual scrollbar width.
7 * xfns.c (x_set_scroll_bar_default_width): Rename wid to unit.
8 For non-toolkit builds again use 14 as minimum width and set
9 FRAME_CONFIG_SCROLL_BAR_WIDTH accordingly.
10 * xterm.c (XTset_vertical_scroll_bar): Take width from
11 WINDOW_SCROLL_BAR_AREA_WIDTH.
12 (x_new_font): Rename wid to unit. Base calculation of new
13 scrollbar width on toolkit used and make it analogous to that of
14 x_set_scroll_bar_default_width.
15 * w32fns.c (x_set_scroll_bar_default_width): Rename wid to unit.
16 (Fx_create_frame): Call x_set_scroll_bar_default_width instead
17 of GetSystemMetrics.
18 * w32term.c (w32_set_vertical_scroll_bar): Take width from
19 WINDOW_SCROLL_BAR_AREA_WIDTH.
20 (x_new_font): Make it correspond to changes in xterm.c.
21
12014-01-01 Paul Eggert <eggert@cs.ucla.edu> 222014-01-01 Paul Eggert <eggert@cs.ucla.edu>
2 23
3 * lisp.h (EMACS_INT): Configure based on INTPTR_MAX, not LONG_MAX. 24 * lisp.h (EMACS_INT): Configure based on INTPTR_MAX, not LONG_MAX.
diff --git a/src/frame.c b/src/frame.c
index 8fd83058520..6024c0c5be5 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3584,6 +3584,8 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3584 do_pending_window_change (0); 3584 do_pending_window_change (0);
3585 } 3585 }
3586 3586
3587 /* Eventually remove the following call. It should have been done by
3588 x_set_window_size already. */
3587 change_frame_size (f, 0, 0, 0, 0, 0, 1); 3589 change_frame_size (f, 0, 0, 0, 0, 0, 1);
3588 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0; 3590 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
3589 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; 3591 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
diff --git a/src/w32fns.c b/src/w32fns.c
index 3d300d7e5df..25dad980aa7 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1851,11 +1851,11 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1851void 1851void
1852x_set_scroll_bar_default_width (struct frame *f) 1852x_set_scroll_bar_default_width (struct frame *f)
1853{ 1853{
1854 int wid = FRAME_COLUMN_WIDTH (f); 1854 int unit = FRAME_COLUMN_WIDTH (f);
1855 1855
1856 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL); 1856 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
1857 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + 1857 FRAME_CONFIG_SCROLL_BAR_COLS (f)
1858 wid - 1) / wid; 1858 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
1859} 1859}
1860 1860
1861 1861
@@ -4407,7 +4407,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4407 XSETFRAME (frame, f); 4407 XSETFRAME (frame, f);
4408 4408
4409 /* By default, make scrollbars the system standard width. */ 4409 /* By default, make scrollbars the system standard width. */
4410 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL); 4410 x_set_scroll_bar_default_width (f);
4411 4411
4412 f->terminal = dpyinfo->terminal; 4412 f->terminal = dpyinfo->terminal;
4413 4413
diff --git a/src/w32term.c b/src/w32term.c
index c66c5b3e573..91235507b21 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3716,7 +3716,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3716 3716
3717 /* Compute the left edge and the width of the scroll bar area. */ 3717 /* Compute the left edge and the width of the scroll bar area. */
3718 left = WINDOW_SCROLL_BAR_AREA_X (w); 3718 left = WINDOW_SCROLL_BAR_AREA_X (w);
3719 width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); 3719 width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
3720 3720
3721 /* Does the scroll bar exist yet? */ 3721 /* Does the scroll bar exist yet? */
3722 if (NILP (w->vertical_scroll_bar)) 3722 if (NILP (w->vertical_scroll_bar))
@@ -5361,6 +5361,7 @@ Lisp_Object
5361x_new_font (struct frame *f, Lisp_Object font_object, int fontset) 5361x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
5362{ 5362{
5363 struct font *font = XFONT_OBJECT (font_object); 5363 struct font *font = XFONT_OBJECT (font_object);
5364 int unit;
5364 5365
5365 if (fontset < 0) 5366 if (fontset < 0)
5366 fontset = fontset_from_font (font_object); 5367 fontset = fontset_from_font (font_object);
@@ -5372,22 +5373,21 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
5372 5373
5373 FRAME_FONT (f) = font; 5374 FRAME_FONT (f) = font;
5374 FRAME_BASELINE_OFFSET (f) = font->baseline_offset; 5375 FRAME_BASELINE_OFFSET (f) = font->baseline_offset;
5375 FRAME_COLUMN_WIDTH (f) = font->average_width; 5376 FRAME_COLUMN_WIDTH (f) = unit = font->average_width;
5376 FRAME_LINE_HEIGHT (f) = font->height; 5377 FRAME_LINE_HEIGHT (f) = font->height;
5377 5378
5378 compute_fringe_widths (f, 1); 5379 compute_fringe_widths (f, 1);
5379 5380
5380 /* Compute the scroll bar width in character columns. */ 5381 /* Compute number of scrollbar columns. */
5382 unit = FRAME_COLUMN_WIDTH (f);
5381 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0) 5383 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
5382 { 5384 FRAME_CONFIG_SCROLL_BAR_COLS (f)
5383 int wid = FRAME_COLUMN_WIDTH (f); 5385 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
5384 FRAME_CONFIG_SCROLL_BAR_COLS (f)
5385 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid - 1) / wid;
5386 }
5387 else 5386 else
5388 { 5387 {
5389 int wid = FRAME_COLUMN_WIDTH (f); 5388 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
5390 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; 5389 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) =
5390 FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
5391 } 5391 }
5392 5392
5393 /* Now make the frame display the given font. */ 5393 /* Now make the frame display the given font. */
diff --git a/src/window.c b/src/window.c
index aa6a3c500f6..f85627ac49f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6631,6 +6631,7 @@ apply_window_adjustment (struct window *w)
6631 adjust_window_margins (w); 6631 adjust_window_margins (w);
6632 clear_glyph_matrix (w->current_matrix); 6632 clear_glyph_matrix (w->current_matrix);
6633 w->window_end_valid = 0; 6633 w->window_end_valid = 0;
6634 windows_or_buffers_changed = 30;
6634 wset_redisplay (w); 6635 wset_redisplay (w);
6635 adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); 6636 adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w)));
6636} 6637}
@@ -6834,9 +6835,7 @@ value. */)
6834{ 6835{
6835 struct window *w = decode_live_window (window); 6836 struct window *w = decode_live_window (window);
6836 6837
6837 return list4 (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6838 return list4 (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (w)),
6838 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6839 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
6840 make_number (WINDOW_SCROLL_BAR_COLS (w)), 6839 make_number (WINDOW_SCROLL_BAR_COLS (w)),
6841 w->vertical_scroll_bar_type, Qnil); 6840 w->vertical_scroll_bar_type, Qnil);
6842} 6841}
diff --git a/src/xfns.c b/src/xfns.c
index 39c895301dc..a78c2bf6b76 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1488,7 +1488,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1488void 1488void
1489x_set_scroll_bar_default_width (struct frame *f) 1489x_set_scroll_bar_default_width (struct frame *f)
1490{ 1490{
1491 int wid = FRAME_COLUMN_WIDTH (f); 1491 int unit = FRAME_COLUMN_WIDTH (f);
1492#ifdef USE_TOOLKIT_SCROLL_BARS 1492#ifdef USE_TOOLKIT_SCROLL_BARS
1493#ifdef USE_GTK 1493#ifdef USE_GTK
1494 int minw = xg_get_default_scrollbar_width (); 1494 int minw = xg_get_default_scrollbar_width ();
@@ -1496,16 +1496,14 @@ x_set_scroll_bar_default_width (struct frame *f)
1496 int minw = 16; 1496 int minw = 16;
1497#endif 1497#endif
1498 /* A minimum width of 14 doesn't look good for toolkit scroll bars. */ 1498 /* A minimum width of 14 doesn't look good for toolkit scroll bars. */
1499 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + wid - 1) / wid; 1499 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + unit - 1) / unit;
1500 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = minw; 1500 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = minw;
1501#else 1501#else
1502 /* Make the actual width 16 pixels and a multiple of a 1502 /* The width of a non-toolkit scrollbar is at least 14 pixels and a
1503 character width. */ 1503 multiple of the frame's character width. */
1504 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (16 + wid - 1) / wid; 1504 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
1505 1505 FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
1506 /* Use all of that space (aside from required margins) for the 1506 = FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
1507 scroll bar. */
1508 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = 16;
1509#endif 1507#endif
1510} 1508}
1511 1509
diff --git a/src/xterm.c b/src/xterm.c
index bffd85c8de4..f47d73cf7ed 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5096,7 +5096,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5096 5096
5097 /* Compute the left edge and the width of the scroll bar area. */ 5097 /* Compute the left edge and the width of the scroll bar area. */
5098 left = WINDOW_SCROLL_BAR_AREA_X (w); 5098 left = WINDOW_SCROLL_BAR_AREA_X (w);
5099 width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); 5099 width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
5100 5100
5101 /* Does the scroll bar exist yet? */ 5101 /* Does the scroll bar exist yet? */
5102 if (NILP (w->vertical_scroll_bar)) 5102 if (NILP (w->vertical_scroll_bar))
@@ -7675,6 +7675,7 @@ Lisp_Object
7675x_new_font (struct frame *f, Lisp_Object font_object, int fontset) 7675x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
7676{ 7676{
7677 struct font *font = XFONT_OBJECT (font_object); 7677 struct font *font = XFONT_OBJECT (font_object);
7678 int unit;
7678 7679
7679 if (fontset < 0) 7680 if (fontset < 0)
7680 fontset = fontset_from_font (font_object); 7681 fontset = fontset_from_font (font_object);
@@ -7694,21 +7695,20 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
7694 7695
7695 compute_fringe_widths (f, 1); 7696 compute_fringe_widths (f, 1);
7696 7697
7697 /* Compute the scroll bar width in character columns. */ 7698 unit = FRAME_COLUMN_WIDTH (f);
7698 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0) 7699#ifdef USE_TOOLKIT_SCROLL_BARS
7699 { 7700 /* The width of a toolkit scrollbar does not change with the new
7700 int wid = FRAME_COLUMN_WIDTH (f); 7701 font but we have to calculate the number of columns it occupies
7701 7702 anew. */
7702 FRAME_CONFIG_SCROLL_BAR_COLS (f) 7703 FRAME_CONFIG_SCROLL_BAR_COLS (f)
7703 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid; 7704 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
7704 } 7705#else
7705 else 7706 /* The width of a non-toolkit scrollbar is at least 14 pixels and a
7706 { 7707 multiple of the frame's character width. */
7707 int wid = FRAME_COLUMN_WIDTH (f); 7708 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
7708 7709 FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
7709 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = 14; 7710 = FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
7710 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; 7711#endif
7711 }
7712 7712
7713 if (FRAME_X_WINDOW (f) != 0) 7713 if (FRAME_X_WINDOW (f) != 0)
7714 { 7714 {