Commit graph

5312 commits

Author SHA1 Message Date
Ashish SHUKLA
4df73585e7
Specify a fallback mouse cursor
`text' cursor is not available in lots of cursor themes, but `xterm'
is, so specify `xterm' as a fallback cursor name.
2022-02-07 22:15:47 +05:30
Ashish SHUKLA
91559fe480
pgo: add stub for render_xcursor_is_valid 2022-02-07 22:15:07 +05:30
Daniel Eklöf
f718af4c1b
doc: ctlseq: OSC-22 2022-02-07 17:28:38 +01:00
Daniel Eklöf
448a0f2833
changelog: OSC-22 2022-02-07 17:28:38 +01:00
Daniel Eklöf
6cdaa4fd0a
osc: implement OSC-22 - set xcursor pointer 2022-02-07 17:28:37 +01:00
Daniel Eklöf
0bf92fff05
term: add term_set_user_mouse_cursor()
This function allows setting a custom mouse cursor.

This is done by adding a ‘char*’ member to the term struct. When it is
non-NULL, we *always* use that pointer (the exception being when the
pointer is hidden), while the pointer is over the grid. This is
instead of the hand/beam pointers we otherwise would use.
2022-02-07 17:28:37 +01:00
Daniel Eklöf
e4f9dc7d58
render: add render_xcursor_is_valid()
Returns true if the provided cursor name is non-NULL, and exist in the
currently loaded xcursor theme.
2022-02-07 17:28:37 +01:00
Daniel Eklöf
92ebe00927
render: call wl_cursor_theme_get_cursor() earlier
Before this patch, wl_cursor_theme_get_cursor() was called in the FDM
hook, just before we’re about to update the mouse cursor “for real”.

This relies on seat->pointer.xcursor still being valid. This is true
as long as we’re only using our compiled-in static xcursor names, but
not otherwise.

Now, we call wl_cursor_theme_get_cursor() in render_xcursor_set(). At
this point, we *know* seat->pointer.xcursor is valid.

There is a slight chance of added overhead here, if the client
application is switching mouse grabbing on/off rapidly. Before, the
calls to wl_cursor_theme_get_cursor() would automatically be
throttled.

However, the main point of delaying the actual pointer update to the FDM
hook is to throttle the *Wayland* calls. And this is still happening:
wl_cursor_theme_get_cursor() is client-side only.
2022-02-07 17:28:28 +01:00
Daniel Eklöf
22307565ac
Merge branch 'pipe-scrollback-crash'
Closes #926
2022-02-07 15:13:31 +01:00
Daniel Eklöf
91be6d2e6e
changelog: crash in pipe-scrollback 2022-02-07 15:12:46 +01:00
Daniel Eklöf
631c63d5a4
term: scrollback-to-text: crash when trying to extract the entire scrollback
We calculated the ‘start’ row by adding the number of screen rows to
the current grid offset. This works in most cases. But not when the
offset is close to the wrap-around.

This triggered a crash when we tried to access a row number larger
than the number of available grid rows.

Fix by bounding the start row to the number of grid rows.

This unearthed a second bug, where trying to extract the scrollback
resulted in nothing getting copied.

The extraction logic did:

   for (r = start; r != (end + 1); r++)
       ....

This works, as long as end isn’t start-1. When we try to extract the
entire scrollback, it _is_ start-1.

Fix by rewriting the loop logic to check for r==end *after* copying
the row contents, but *before* incrementing r.

Closes #926
2022-02-07 15:12:38 +01:00
Daniel Eklöf
b2d59a0e54
Merge branch 'selection-handling-during-reflow'
Closes #924
2022-02-07 15:12:08 +01:00
Daniel Eklöf
1b0cfafb9e
changelog: scrollback wrap-around crossing selections 2022-02-07 15:06:55 +01:00
Daniel Eklöf
ef522e292f
selection: foreach: sort start/end based on their scrollback-start relative values
When iterating the characters in a selection, we want to go from the
“start” to the “end”, where start is the upper left-most character,
and “end” is the lower right-most character.

There are two things to consider:

* The ‘start’ coordinate may actually sort after the ‘end’
  coordinate (user selected from bottom of the window and upward)
* The scrollback wraparound.

What we do is calculate both the star and end coordinates’
scrollback-start relative row numbers. That is, the number of rows
from the beginning of the scrollback. So if the very first
row (i.e. the oldest) in the scrollback is selected, that has the
scrollback-start relative number “0”.

Then we loop from whichever (start or end coordinate) is highest up in
the scrollback, to the “other” coordinate.
2022-02-07 15:06:55 +01:00
Daniel Eklöf
0800515c04
grid: reflow: add TODO to detect selection on re-used rows, and cancel it 2022-02-07 15:06:55 +01:00
Daniel Eklöf
2e828248d0
selection: ensure start/end coordinates are bounded by the current grid
Closes #924
2022-02-07 15:06:39 +01:00
Craig Barnes
ff90781ebc tests: fix typo in error message 2022-02-07 12:32:23 +00:00
Daniel Eklöf
3baf7de3b8
Merge branch 'finalize-selection-on-window-resize'
Closes #922
2022-02-07 13:23:56 +01:00
Daniel Eklöf
09fd39bb29
changelog: mouse selections are finalized on window resize 2022-02-07 10:44:00 +01:00
Daniel Eklöf
003ea4904d
render: resize: add TODO: translate pivot coords 2022-02-07 10:42:32 +01:00
Daniel Eklöf
a187271ca4
render: resize: finalize selection before reflowing the grid
This fixes a crash caused by the selection’s pivot point not being
translated during reflow.

While we could simply reflow the pivot point as well, testing shows
irregular behavior with ongoing selections across window resizes, with
different compositors behaving differently.

For now, we simply finalize the selection, instead of trying to handle
ongoing selections.

Closes #922
2022-02-07 10:38:30 +01:00
Daniel Eklöf
b4027118e6
term: init: initialize selection pivot point coords to -1,-1
While this _shouldn’t_ be necessary (pivot points are only used while
a selection is ongoing). But it doesn’t hurt to initialize them
anyway.
2022-02-07 10:36:59 +01:00
Daniel Eklöf
1eef5a00e6
changelog: “(null)” being logged as font-name 2022-02-06 12:07:58 +01:00
Daniel Eklöf
b0e9ee2137
config: font->name may be NULL
If it is, fallback to the font pattern instead, like we used to do
before fcft-3.
2022-02-06 12:07:42 +01:00
Daniel Eklöf
87c0d857cf
changelog: missing ‘wayland_client’ dependency in test-config 2022-02-06 12:05:01 +01:00
Daniel Eklöf
203a09d533
meson: tests: config: add missing ‘wayland_client’ dependency
Closes #918
2022-02-06 12:02:42 +01:00
Daniel Eklöf
b3849cb983
changelog: add new ‘unreleased’ section 2022-02-05 17:38:24 +01:00
Daniel Eklöf
85be473303
Merge branch 'releases/1.11' 2022-02-05 17:37:58 +01:00
Daniel Eklöf
8c66dbbd78
ci: codespell: don’t uppercase words in the exclude list 2022-02-05 17:31:16 +01:00
Daniel Eklöf
1b0fac49ed
ci: fix codespell -L usage, take 2 2022-02-05 17:30:09 +01:00
Daniel Eklöf
e5926ad6be
ci: fix codespell -L usage 2022-02-05 17:29:23 +01:00
Daniel Eklöf
bfab825b02
ci: use fcft master branch 2022-02-05 17:27:30 +01:00
Daniel Eklöf
6c38c2358a
ci: allow ‘Ser’ (as in Simon Ser) in Codespell 2022-02-05 17:26:14 +01:00
Daniel Eklöf
844563a791
main: remove debug logging 2022-02-05 17:22:01 +01:00
Daniel Eklöf
3fea7829fa
meson: bump version to 1.11.0 2022-02-05 17:20:27 +01:00
Daniel Eklöf
ccb0cd178f
changelog: prepare for 1.11.0 2022-02-05 17:19:43 +01:00
Daniel Eklöf
52f1f44897
Merge branch 'fcft-3' 2022-02-05 17:15:49 +01:00
Daniel Eklöf
dc42b41b62
char32: inline wcs*() wrappers 2022-02-05 17:00:54 +01:00
Daniel Eklöf
e0227266ca
fcft: adapt to API changes in fcft-3.x
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.

Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.

For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).

Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.

These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.

For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the  __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.

FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.

Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.

Other fcft API changes:

* fcft_glyph_rasterize() -> fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
2022-02-05 17:00:54 +01:00
Daniel Eklöf
2be8c39044
Merge branch 'config-no-null-strings-in-printf' 2022-02-05 17:00:08 +01:00
Daniel Eklöf
343f2c51a4
config: s/of the form/on the form/ 2022-02-05 16:59:42 +01:00
Daniel Eklöf
a339c40f5d
changelog: XF86Copy+XF86Paste are now recognized by default 2022-02-05 16:42:38 +01:00
Pranjal Kole
06fdebbbcb config: use getline idiomatically
getline(3) contains an example program at the end, showing its usage.

A few other changes have also been made.
2022-02-05 13:48:08 +05:30
Pranjal Kole
65b5469e86 config: don't pass null strings to *printf()
musl and glibc's *printf() convert NULL strings to "(null)" [0][1], but
this is undefined behaviour.

context.value has to be set to two backspaces, so that the extra colon
is removed. context.key is set to one backspace, so that the extra dot
is removed. context.section is now set to "main" by default, so it is
never NULL.

[0]: https://git.musl-libc.org/cgit/musl/tree/src/stdio/vfprintf.c#n593
[1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=stdio-common/vfprintf-internal.c;hb=HEAD#l1011
2022-02-05 11:50:41 +05:30
Daniel Eklöf
ef54b7f2e5
Merge branch 'improve-shellscript' 2022-02-04 21:30:04 +01:00
Daniel Eklöf
e97e873b9e
box-drawing: LIGHT ARC: check for sqrt() failures
Closes #914
2022-02-04 18:15:35 +01:00
Daniel Eklöf
a5f8ed1b78
Merge branch 'sixel-repeat-edge-cases' 2022-02-04 18:14:32 +01:00
Daniel Eklöf
58bbbb0a31
sixel: revert to default state when an invalid DECGRI character is received 2022-02-04 18:14:25 +01:00
Daniel Eklöf
9e8d553a21
sixel: DECGRI (repeat) with a count of 0 should emit a single sixel 2022-02-04 18:14:24 +01:00
Daniel Eklöf
9150507209
sixel: resize: truncate instead of failing, when new size exceeds max size
If the size we’re trying to set exceeds the configured max size,
truncate instead of failing.
2022-02-04 18:14:24 +01:00