diff options
author | Wolfgang Müller | 2021-06-18 19:53:41 +0200 |
---|---|---|
committer | Wolfgang Müller | 2021-06-19 15:53:07 +0200 |
commit | 89f8571cbcf48b7810c7027faf26ee5cf4b968b1 (patch) | |
tree | eaf84e00488e332f52c865167290a441d27f447e /NEWS | |
parent | ff27c3da1266df519aa15d95cfc32ad9d0d7b5e5 (diff) | |
download | weltschmerz-89f8571cbcf48b7810c7027faf26ee5cf4b968b1.tar.gz |
Calculate base_width dynamically
weltschmerz sets window geometry hints to indicate how the terminal
window is to be sized and resized. New sizes are always kept at a
multiple of the character width and height. Effectively, this ensures
that terminal windows never have "negative space" that is not used for
any terminal output.
In order to account for padding and non-terminal widgets, one may
specify base_height and base_width. These values indicate how much space
to add in a final step, after the character width and heights have been
multiplied with the amount of columns and rows respectively. For
example, allowed window widths are always:
(char_width * N) + base_width
Currently, we always use a base_width of 2 * 2. This is to account for
the padding of 2 pixels as specified in terminal.css.
weltschmerz uses GtkScrolledWindow and overlay scrolling by default.
With overlay_scrolling enabled, the scrollbar does not take up any extra
space. The previous commit works around a problem with GtkScrolledWindow
and sets PolicyType.ALWAYS when overlay scrolling is turned off. This
means that we now also have to account for the size of that scrollbar.
Since we cannot simply query the size of the scrollbar, we have to be a
bit more creative. Use the full window width and subtract the width of
the terminal at startup (we know it is always 80 columns) to get the
amount of space taken up by "anything else". This includes VTE padding
and the scrollbar size.
Importantly, this needs only be done once and is completely agnostic to
any further changes to the terminal or font size (which affects the cell
width and height). We only assume that both the size of the scrollbar
and the amount of padding is constant, which we feel to be a reasonable
trade-off.
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions