[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115833: Further adjust frame/window scrollbar width
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] trunk r115833: Further adjust frame/window scrollbar width calculations. |
Date: |
Thu, 02 Jan 2014 15:59:17 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115833
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2014-01-02 16:58:48 +0100
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/frame.c frame.c-20091113204419-o5vbwnq5f7feedwu-243
src/w32fns.c w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
src/w32term.c w32term.c-20091113204419-o5vbwnq5f7feedwu-950
src/window.c window.c-20091113204419-o5vbwnq5f7feedwu-231
src/xfns.c xfns.c-20091113204419-o5vbwnq5f7feedwu-274
src/xterm.c xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-01-01 19:27:41 +0000
+++ b/src/ChangeLog 2014-01-02 15:58:48 +0000
@@ -1,3 +1,24 @@
+2014-01-02 Martin Rudalics <address@hidden>
+
+ 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 <address@hidden>
* lisp.h (EMACS_INT): Configure based on INTPTR_MAX, not LONG_MAX.
=== modified file 'src/frame.c'
--- a/src/frame.c 2014-01-01 07:43:34 +0000
+++ b/src/frame.c 2014-01-02 15:58:48 +0000
@@ -3584,6 +3584,8 @@
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;
=== modified file 'src/w32fns.c'
--- a/src/w32fns.c 2014-01-01 07:43:34 +0000
+++ b/src/w32fns.c 2014-01-02 15:58:48 +0000
@@ -1851,11 +1851,11 @@
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 @@
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;
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2014-01-01 07:43:34 +0000
+++ b/src/w32term.c 2014-01-02 15:58:48 +0000
@@ -3716,7 +3716,7 @@
/* 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 @@
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 @@
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. */
=== modified file 'src/window.c'
--- a/src/window.c 2014-01-01 07:43:34 +0000
+++ b/src/window.c 2014-01-02 15:58:48 +0000
@@ -6631,6 +6631,7 @@
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 @@
{
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);
}
=== modified file 'src/xfns.c'
--- a/src/xfns.c 2014-01-01 07:43:34 +0000
+++ b/src/xfns.c 2014-01-02 15:58:48 +0000
@@ -1488,7 +1488,7 @@
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 @@
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
}
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2014-01-01 07:43:34 +0000
+++ b/src/xterm.c 2014-01-02 15:58:48 +0000
@@ -5096,7 +5096,7 @@
/* 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 @@
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 @@
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)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115833: Further adjust frame/window scrollbar width calculations.,
Martin Rudalics <=