While pasting data from the clipboard, block *all* other data from
being sent to the client. This includes keyboard and mouse events, but
also replies for VT queries.
This is particularly important when bracketed paste has been enabled,
since then the client will interpret *everything* between the
bracketed paste start and end as paste data.
When reading clipboard data, a malicious clipboard provider could
stall us forever, by not sending any data, and not closing the pipe.
This commit adds a timer_fd based timeout of 2 seconds. If the timer
triggers, we abort the clipboard receive.
When calculating where in the scrollback history we are, we previously
did this against the total number of scrollback lines. I.e. the
`scrollback.lines` setting in `footrc`.
Now, we count only the used/allocated scrollback lines.
Note that the initial indicator position might still seem to start a
bit high up, if the number of used scrollback lines is low. This is
because we use the *top* of the screen for the current position. Thus,
we'll never be at the bottom (except for the special case when
we're *really* at the bottom).
The switch statements use the GCC extension "case X ... Y", and here
it doesn't really make any sense to convert it to "case X: case Y:",
so hide the warnings instead.
This is also done by libvte, alacritty, kitty and several other
terminal emulators as a way to indicate support for 24-bit RGB
colors. It generally also implies support for the xterm 256-color
palette and basic ECMA-48 colors.
This introduces a new state to a seat's mouse struct, 'consumed'. It
is set on a mouse *press* event that is claimed by a mouse binding.
It is cleared after a mouse *release* event.
While set, *no* mouse motion or button events are sent to the client
application.
'n' _is_ ignored when 'dest' is NULL, but you can still get the
following warning:
In function ‘mbstowcs’,
inlined from ‘parse_section_scrollback’ at ../config.c:429:26:
/usr/include/bits/stdlib.h:129:10: warning: ‘__mbstowcs_alias’ specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
129 | return __mbstowcs_alias (__dst, __src, __len);
To silence this warning, pass 0 instead, since it is ignored anyway.