Before this patch, we didn’t ensure width and height were valid for
the current scaling factor, when fractional scaling _is_
available. That is, we didn’t ensure the width/height values
multiplied back to their original values after dividing with the
scaling factor.
Closes#1446
This function is only called directly when scaling the mouse
pointer. The mouse pointer is never guaranteed to have a valid width
and height, so skip the width/height assertions for it.
* Ensure buffer sizes are valid. That is, ensure that
size / scale * scale == size.
* Do size calculation of the window geometry in the same way we
calculate the CSD offsets.
And calculation of compounded offsets/widths/heights, to compensate
for compositor rounding when positioning and scaling/sizing
subsurfaces.
Closes#1441
When instantiating the viewport for a pointer surface, we didn't first
check if the compositor implements the viewporter interface.
This triggered a crash when a) foot was compiled with fractional
scaling, and b) the compositor did not implement the viewporter
interface.
Closes#1444
This defines the base name of the generated terminfo files. It
defaults to the value of -Ddefault-terminfo (i.e. 'foot')
Example:
meson -Ddefault-terminfo=foot-bananas -Dterminfo-base-name=foot-apples
The generated terminfo files will be
* terminfo/f/foot-apples
* terminfo/f/foot-apples-direct
The default value of $TERM will be 'foot-bananas'
By how much to increase the luminance when brightening bold
fonts. This was previously hard-coded to a factor of 1.3, which is now
the default value of the new config option.
Closes#1434
render_osd() shouldn't use term_font_baseline().
This is because term_font_baseline() uses the line height to determine
the position, while render_osd() renders to surfaces that aren't sized
like the grid.
This fixes a regression, where the CSD title were sometimes rendered
too high up, and sometimes too low.
* In all calls to wl_subsurface_set_position()
* (wp_viewport_set_destination() already does this)
* Whenever we use the scale to calculate margins (search box,
scrollback indicator etc)
* Since the scaling factor is stored as a float (and not a double),
use roundf() instead of round()
Monitor DPI depends on information from both the wl_output and the
xdg_output interfaces.
Before this patch, terminals were only updated after changes to the
wl_output interfaces (thus depending on xdg output changes being
pushed by the compositor before wl_output changes).
That assumption (xdg_output happening before wl_output) isn’t always
true.
This patch fixes the issue by updating the terminals in the
xdg_output’s “done” event.
Closes#1431
This patch detects invalid codepoints in the UTF-8 EDxxxx range, and
the F4xxxxxx range.
Note that we still allow the E0xxxx and F0xxxxxx ranges. These
contains overlong encodings. We allow them, because they still decode
into correct UTF-32.
Closes#1423
- wayland-instance template target was a mistake.
Systemd does not support simultaneous same user session, so stop
trying to go against that.
- Only start systemd units in Wayland environments.
Even if WAYLAND_DISPLAY / XDG_RUNTIME_DIR are defined, if we can't
find the corresponding socket, we fallback to the path used when they
are not defined.
Do not insert existing positions into the tab stop list.
This prevents a performance issue when iterating through
an extremely long tab stop list.
Also corrects the behaviour of CBT.
The wayland protocol recommends (or mandates?) that compositors render
a black background behind fullscreened transparent windows. I.e. you
never see what’s _actually_ behind the window.
So, if you have a white, but semi-transparent background in foot,
it’ll be rendered in a shade of gray.
Given this, it’s better to simply disable transparency while we’re
fullscreened. That way, we at least get the "correct" background
color.
Closes#1416
This fixes a crash-on-exit on compositors that emit a _"keyboard
leave"_ event when a surface is unmapped.
In our case, destroying the window (where we unmap it) in
term_destroy(), lead to a crash in term_mouse_grabbed(), due to
key_binding_for() returning NULL.
The call chain in this is case is, roughly:
term_destroy() ->
wayl_win_destroy() ->
keyboard_leave() ->
term_xcursor_update_for_seat() ->
term_mouse_grabbed()
Break out the logic that updates the terminal’s scaling factor value,
from render_resize(), to a new function, term_update_scale(). This
allows us to update the scaling factor without a full grid resize.
We also change how we pick the scaling factor (when fractional scaling
is not in use). Before, we’d use the highest scaling factor from all
monitors we were mapped on. Now, we use the scaling factor from the
monitor we were *last* mapped on.
Then, add a boolean parameter to term_set_fonts(), and when
false, *don’t* call render_resize_force().
Also change term_font_dpi_changed() to only return true if the font
was changed in any way.
Finally, rewrite update_term_for_output_change() to:
* Call term_update_scale() before doing anything else
* Call render_resize{,_force} *last*, and *only* if either the scale
or the fonts were updated.
This fixes several things:
* A bug where we failed to update the fonts when fractional scaling
was in use, and we guessed the initial scale/DPI wrong. The bug
happened because updated the internal "preferred" scale value, and a
later call to render_resize() updated the terminal’s scale value,
but since that code path didn’t call term_font_dpi_changed() (and it
shouldn’t), the fonts weren’t resized properly.
* It ensures we only resize the grid *once* when the scaling factor,
or DPI is changed. Before this, we’d resize it twice. And this
happened when e.g. dragging the window between monitors.
With legacy scaling, we need to use a "scaled", or "logical" DPI
value, that is basically the real DPI value scaled by the monitor’s
scaling factor.
This is necessary to compensate for the compositor downscaling the
surface, for "fake" fractional scaling.
But with true fractional scaling, *we* scale the surface to the final
size. This means we should *not* use the scaled DPI, but the monitor’s
actual DPI.
To facilitate this, store both the scaled and the unscaled DPI value
in the monitor struct.
This patch also changes how we pick the DPI value. Before, we would
use the highest DPI value from all the monitors we were mapped
on. Now, we use the DPI value from the monitor we were *last* mapped
on (typically the window we’re dragging the window *to*).