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.
This commit is contained in:
parent
c4377e925a
commit
44c5e192be
7 changed files with 62 additions and 42 deletions
|
@ -1,3 +1,24 @@
|
|||
2014-01-02 Martin Rudalics <rudalics@gmx.at>
|
||||
|
||||
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.
|
||||
|
||||
2014-01-01 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* lisp.h (EMACS_INT): Configure based on INTPTR_MAX, not LONG_MAX.
|
||||
|
|
|
@ -3584,6 +3584,8 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
|
|||
do_pending_window_change (0);
|
||||
}
|
||||
|
||||
/* Eventually remove the following call. It should have been done by
|
||||
x_set_window_size already. */
|
||||
change_frame_size (f, 0, 0, 0, 0, 0, 1);
|
||||
XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
|
||||
XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
|
||||
|
|
|
@ -1851,11 +1851,11 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
|
|||
void
|
||||
x_set_scroll_bar_default_width (struct frame *f)
|
||||
{
|
||||
int wid = FRAME_COLUMN_WIDTH (f);
|
||||
int unit = FRAME_COLUMN_WIDTH (f);
|
||||
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) +
|
||||
wid - 1) / wid;
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f)
|
||||
= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4407,7 +4407,7 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
XSETFRAME (frame, f);
|
||||
|
||||
/* By default, make scrollbars the system standard width. */
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
|
||||
x_set_scroll_bar_default_width (f);
|
||||
|
||||
f->terminal = dpyinfo->terminal;
|
||||
|
||||
|
|
|
@ -3716,7 +3716,7 @@ w32_set_vertical_scroll_bar (struct window *w,
|
|||
|
||||
/* Compute the left edge and the width of the scroll bar area. */
|
||||
left = WINDOW_SCROLL_BAR_AREA_X (w);
|
||||
width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
|
||||
width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
|
||||
|
||||
/* Does the scroll bar exist yet? */
|
||||
if (NILP (w->vertical_scroll_bar))
|
||||
|
@ -5361,6 +5361,7 @@ Lisp_Object
|
|||
x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
|
||||
{
|
||||
struct font *font = XFONT_OBJECT (font_object);
|
||||
int unit;
|
||||
|
||||
if (fontset < 0)
|
||||
fontset = fontset_from_font (font_object);
|
||||
|
@ -5372,22 +5373,21 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
|
|||
|
||||
FRAME_FONT (f) = font;
|
||||
FRAME_BASELINE_OFFSET (f) = font->baseline_offset;
|
||||
FRAME_COLUMN_WIDTH (f) = font->average_width;
|
||||
FRAME_COLUMN_WIDTH (f) = unit = font->average_width;
|
||||
FRAME_LINE_HEIGHT (f) = font->height;
|
||||
|
||||
compute_fringe_widths (f, 1);
|
||||
|
||||
/* Compute the scroll bar width in character columns. */
|
||||
/* Compute number of scrollbar columns. */
|
||||
unit = FRAME_COLUMN_WIDTH (f);
|
||||
if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
|
||||
{
|
||||
int wid = FRAME_COLUMN_WIDTH (f);
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f)
|
||||
= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid - 1) / wid;
|
||||
}
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f)
|
||||
= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
|
||||
else
|
||||
{
|
||||
int wid = FRAME_COLUMN_WIDTH (f);
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) =
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
|
||||
}
|
||||
|
||||
/* Now make the frame display the given font. */
|
||||
|
|
|
@ -6631,6 +6631,7 @@ apply_window_adjustment (struct window *w)
|
|||
adjust_window_margins (w);
|
||||
clear_glyph_matrix (w->current_matrix);
|
||||
w->window_end_valid = 0;
|
||||
windows_or_buffers_changed = 30;
|
||||
wset_redisplay (w);
|
||||
adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w)));
|
||||
}
|
||||
|
@ -6834,9 +6835,7 @@ value. */)
|
|||
{
|
||||
struct window *w = decode_live_window (window);
|
||||
|
||||
return list4 (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
|
||||
? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
|
||||
: WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
|
||||
return list4 (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (w)),
|
||||
make_number (WINDOW_SCROLL_BAR_COLS (w)),
|
||||
w->vertical_scroll_bar_type, Qnil);
|
||||
}
|
||||
|
|
16
src/xfns.c
16
src/xfns.c
|
@ -1488,7 +1488,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
|
|||
void
|
||||
x_set_scroll_bar_default_width (struct frame *f)
|
||||
{
|
||||
int wid = FRAME_COLUMN_WIDTH (f);
|
||||
int unit = FRAME_COLUMN_WIDTH (f);
|
||||
#ifdef USE_TOOLKIT_SCROLL_BARS
|
||||
#ifdef USE_GTK
|
||||
int minw = xg_get_default_scrollbar_width ();
|
||||
|
@ -1496,16 +1496,14 @@ x_set_scroll_bar_default_width (struct frame *f)
|
|||
int minw = 16;
|
||||
#endif
|
||||
/* A minimum width of 14 doesn't look good for toolkit scroll bars. */
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + wid - 1) / wid;
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + unit - 1) / unit;
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = minw;
|
||||
#else
|
||||
/* Make the actual width 16 pixels and a multiple of a
|
||||
character width. */
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (16 + wid - 1) / wid;
|
||||
|
||||
/* Use all of that space (aside from required margins) for the
|
||||
scroll bar. */
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = 16;
|
||||
/* The width of a non-toolkit scrollbar is at least 14 pixels and a
|
||||
multiple of the frame's character width. */
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
|
||||
= FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
32
src/xterm.c
32
src/xterm.c
|
@ -5096,7 +5096,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
|
|||
|
||||
/* Compute the left edge and the width of the scroll bar area. */
|
||||
left = WINDOW_SCROLL_BAR_AREA_X (w);
|
||||
width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
|
||||
width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
|
||||
|
||||
/* Does the scroll bar exist yet? */
|
||||
if (NILP (w->vertical_scroll_bar))
|
||||
|
@ -7675,6 +7675,7 @@ Lisp_Object
|
|||
x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
|
||||
{
|
||||
struct font *font = XFONT_OBJECT (font_object);
|
||||
int unit;
|
||||
|
||||
if (fontset < 0)
|
||||
fontset = fontset_from_font (font_object);
|
||||
|
@ -7694,21 +7695,20 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
|
|||
|
||||
compute_fringe_widths (f, 1);
|
||||
|
||||
/* Compute the scroll bar width in character columns. */
|
||||
if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
|
||||
{
|
||||
int wid = FRAME_COLUMN_WIDTH (f);
|
||||
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f)
|
||||
= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid;
|
||||
}
|
||||
else
|
||||
{
|
||||
int wid = FRAME_COLUMN_WIDTH (f);
|
||||
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = 14;
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
|
||||
}
|
||||
unit = FRAME_COLUMN_WIDTH (f);
|
||||
#ifdef USE_TOOLKIT_SCROLL_BARS
|
||||
/* The width of a toolkit scrollbar does not change with the new
|
||||
font but we have to calculate the number of columns it occupies
|
||||
anew. */
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f)
|
||||
= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
|
||||
#else
|
||||
/* The width of a non-toolkit scrollbar is at least 14 pixels and a
|
||||
multiple of the frame's character width. */
|
||||
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
|
||||
FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
|
||||
= FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
|
||||
#endif
|
||||
|
||||
if (FRAME_X_WINDOW (f) != 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue