Commit graph

5869 commits

Author SHA1 Message Date
Daniel Eklöf
3cd0e2adb0
themes: enable custom cursor colors in all themes that define such colors
Not all themes have/define custom cursor colors. But of those that do,
nearly all already enabled them (by setting "cursor.color"), except
three themes:

* aeroroot
* ayu-mirage
* material-amber

This patch makes all themes consistent, by enabling cursor.color in
these last three themes too.
2023-07-14 10:20:20 +02:00
Daniel Eklöf
efc619b0af
config: make ‘starlight’ the default color theme
Closes #1321
2023-07-14 10:11:43 +02:00
Daniel Eklöf
f53e7f7478
themes: aeroroot: add -*- conf -*- header 2023-07-14 10:03:56 +02:00
Daniel Eklöf
235e0e9e60
themes: starlight: add -*- conf -*- header 2023-07-14 10:03:22 +02:00
Daniel Eklöf
28ab41caad
theme: add new theme ‘starlight’
Closes #1321
2023-07-14 10:02:21 +02:00
Daniel Eklöf
b3745b31c7
render: don’t invert cursor colors when custom colors are being used
When the user has configured custom cursor colors (cursor.color is set
in foot.ini), don’t invert those colors when the cell is either
selected, or has the ‘reverse’ attribute set.

This aligns foot’s behavior with Alacritty, Kitty and Wezterm. Contour
also behaves similarly, except mouse selections override the cursor
colors (turning the cursor invisible).

Closes #1347
2023-07-14 09:57:10 +02:00
Daniel Eklöf
66df6fb2f6
themes: ayu-mirag: disable cursor colors by default
Default cursor color is "inversed fg/bg", and themes aren’t supposed
to change that.
2023-07-14 09:55:57 +02:00
ShugarSkull
98dfeb05ab
ayu-mirage theme added 2023-07-14 09:55:54 +02:00
Daniel Eklöf
50f47dcba9
themes: aeroroot: disable cursor colors by default
Default cursor color is "inversed fg/bg", and themes aren’t supposed
to change that.
2023-07-14 09:11:30 +02:00
Kyle Gunger
efc89a7317
Aero root theme 2023-07-14 09:11:25 +02:00
CismonX
dbee099eeb
sixel: fix regression for DECGRI with a repeat count of 0 2023-07-11 00:51:32 +08:00
Daniel Eklöf
7fa4a36c08
Merge branch 'control-shift-u'
Closes #1183
2023-07-10 12:44:33 +02:00
Daniel Eklöf
3609017c38
changelog: mention the new default key binding for show-urls-launch under “fixed”
It “fixes” the key binding conflict seen on e.g. GNOME, and increases
the exposure of the change to, hopefully, more users.
2023-07-10 12:42:36 +02:00
Daniel Eklöf
58898c0633
changelog: split up key binding changes for show-urls-launch and unicode-input 2023-07-10 12:42:10 +02:00
Daniel Eklöf
0e1dbbbd06
doc: foot: add default key binding for unicode input 2023-07-10 12:37:10 +02:00
Daniel Eklöf
5b74808ed0
doc: foot: update default key binding for URL mode 2023-07-10 12:36:55 +02:00
Daniel Eklöf
87d45c2a01
readme: add default shortcut for unicode input 2023-07-10 12:36:41 +02:00
Daniel Eklöf
19e37b17aa
readme: a few more places mentioning the default URL mode shortcut 2023-07-10 12:36:18 +02:00
Antoine Beaupré
080a11eb73
bind control-shift-u to unicode-input, move urls to o
Having a keybinding to invoke arbitrary unicode characters is very
useful. It's often used as a method of last resort to communicate with
people outside of your main language. For example, if you want to type
the last letter of my real name, you can invoke the latin-1 character
0xe9 or unicode 0x00e9.

You can also use this to type special characters, for example, unicode
U+1F4A9 is of course, the infamous PILE OF POO, which is sure to
produce million laughs everywhere you go.

In foot, there's no keybinding by default to invoke the very useful
unicode-input command. There is no "standard" (as in "ISO") keybinding
this either. But there *is* a de-facto standard currently deployed
by *both* GTK and Qt (a rare feat) *and* Chrome OS (an even rarer
feat) and it's control-shift-u.

Alternatives include Control-x 8 (emacs), Control V u (vim),
Alt (Windows, LibreOffice), or Option (Mac). I doubt we want to adopt
any of those.

So let's use control-shift-u for this. Unfortunately, it's currently
assigned to show-urls-launch, which is unfortunate, but
insurmountable. We can reassign this keybinding elsewhere. I have
picked control-shift-o in my configuration, because "o" is a good
mnemonic for "open URLs". Others have suggested "m" instead.

Closes: #1183
2023-07-10 12:31:51 +02:00
CismonX
d2fcb5343f
input: add basic support for touchscreen input
Closes #517
2023-07-05 16:22:28 +02:00
Daniel Eklöf
4a73828911
changelog: fractional-scaling-v1 -> fractional-scale-v1 2023-07-04 08:38:07 +02:00
Craig Barnes
247035e9e4 meson: fix typo in meson_options.txt
When using muon[1] instead of meson, this was causing the following
error:

    $ muon setup bld
    .../meson_options.txt:26:124: error unterminated hex escape
    .../meson_options.txt:26:223: error unterminated string

[1]: https://muon.build/
2023-07-03 20:11:20 +01:00
Daniel Eklöf
e00a20465b
Merge branch 'cursor-shape'
Closes #1379
2023-07-03 15:01:49 +02:00
Daniel Eklöf
3800b279d6
meson: move cursor-shape.{c,h} from ‘foot’ binary to vtlib
This should fix a build issue when doing partial PGO builds, when
cursor-shape-v1 is *available*.
2023-07-03 14:42:22 +02:00
Daniel Eklöf
ba09d55aab
term_xcursor_update_for_seat(): fix missing evaluation of render_xcursor_is_valid()
When compiling *without* cursor-shape-v1 support,
term_xcursor_update_for_seat() would incorrectly set
shape=CURSOR_SHAPE_CUSTOM, even though no custom cursor had been set
by the user.

This resulted in a crash in render_xcursor_set(), when trying to use a
NULL-string as custom cursor.
2023-07-03 14:36:33 +02:00
Daniel Eklöf
8fc43ccd2d
meson: log availability of cursor-shape-v1 2023-07-03 14:36:33 +02:00
Daniel Eklöf
a361d7917b
main/client: add a version feature flag for cursor-shape 2023-07-03 14:36:33 +02:00
Daniel Eklöf
6388954e8f
render: move variables inside #ifdef, as they’re not used outside of it 2023-07-03 14:36:33 +02:00
Daniel Eklöf
7bfa700c55
terminal: #elif -> #else 2023-07-03 14:36:33 +02:00
Daniel Eklöf
c2e481fb6a
meson: bump wayland-protocols version required for cursor-shape to 1.32 2023-07-03 14:36:32 +02:00
Daniel Eklöf
c2baaff3c1
cursor-shape: use server-side cursors for custom (OSC-22), if possible
Using a lookup table, try to map the user-provided xcursor string to a
cursor-shape-v1 known shape.

If we succeed, set the user’s custom cursor using server side
cursors (i.e. using cursor-shape-v1).

If not, fallback to trying to load the image ourselves (using
wl_cursor_theme_get_cursor()), and set it using the legacy
wl_pointer_set_cursor().
2023-07-03 14:36:32 +02:00
Daniel Eklöf
bf83a0b2bd
meson: cursor-shape: use .xml from wayland-protocols
This patch assumes a git snapshot of wayland-protocols are
installed.

We need to bump the version number as soon as the next version of
wayland-protocols have been released.
2023-07-03 14:36:32 +02:00
Daniel Eklöf
ddd6004b27
render: don’t (can’t) use cursor-shape-v1 when user has set a custom cursor
Well, we _could_, but we’d have to reverse map the string to a
cursor-shape-v1 enum value. Let’s not do that, for now at least.
2023-07-03 14:36:32 +02:00
Daniel Eklöf
9155948ac8
cursor-shape: assert lookup succeeded 2023-07-03 14:36:32 +02:00
Daniel Eklöf
803b250652
pgo: update xcursor stubs to use enum instead of char pointer 2023-07-03 14:36:32 +02:00
Daniel Eklöf
6ed5dce5ab
render: debug log which method we use to set the xcursor 2023-07-03 14:36:32 +02:00
Daniel Eklöf
c8e13ad393
cursor-shape: add support for server side cursor shapes
This implements support for the new cursor-shape-v1 protocol. When
available, we use it, instead of client-side cursor surfaces, to
select the xcursor shape.

Note that we still need to keep client side pointers, for:

* backward compatibility
* to be able to "hide" the cursor

Closes #1379
2023-07-03 14:36:32 +02:00
Daniel Eklöf
ee794a121e
refactor: track current xcursor using an enum, instead of a char pointer 2023-07-03 14:36:32 +02:00
Daniel Eklöf
72bc0acfbd
wayland: handle enum value XDG_TOPLEVEL_STATE_SUSPENDED
Added in wayland-protocols-1.32
2023-07-03 14:36:03 +02:00
Daniel Eklöf
49fb0cf359
sixel: re-scale images when the cell dimensions change
Before this patch, when the cell dimensions changed (i.e. when the
font size changes), sixel images were either removed (the new cell
dimensions are smaller than the old), or simply kept at their original
size (new cell dimensions are larger).

With this patch, sixels are instead resized. This means a
sixel *always* occupies the same number of rows and columns,
regardless of how much the font size is changed.

This is done by maintaining two sets of image data and pixman images,
as well as their dimensions. These two sets are the new ‘original’ and
‘scaled’ members of the sixel struct.

The "top-level" pixman image pointer, and the ‘width’ and ‘height’
members either point to the "original", or the "scaled" version.

They are invalidated as soon as the cell dimensions change. They, and
the ‘scaled’ image is updated on-demand (when we need to render a
sixel).

Note that the ‘scaled’ image is always NULL when the current cell
dimensions matches the ones used when emitting the sixel (to save
run-time memory).

Closes #1383
2023-06-30 08:29:35 +02:00
Daniel Eklöf
7a37e6891f
meson: log availability of optional wayland protocols 2023-06-30 08:28:20 +02:00
Daniel Eklöf
5e305fa854
wayland: typo: ‘.’ -> ‘;’
Closes #1392
2023-06-30 08:24:02 +02:00
Daniel Eklöf
df71d9c6de
Merge branch 'sixel-performance'
Closes #1385
2023-06-29 15:40:21 +02:00
Daniel Eklöf
5e9d68695c
sixel: add_ar_11(): manually unroll loop
This generates both smaller, and faster code
2023-06-29 15:40:00 +02:00
Daniel Eklöf
fc46087ce9
scripts: generate-alt-random: set P2=1 when emitting sixels
P2=1 means "empty sixels remain at their current color". This is
usually the case with modern sixel encoders.
2023-06-29 15:40:00 +02:00
Daniel Eklöf
75f9bed6b6
sixel: refactor: shorten very verbose switch case statements 2023-06-29 15:40:00 +02:00
Daniel Eklöf
3555e81fee
sixel: special case parsing of images with an aspect ratio of 1:1
Images with an aspect ratio of 1:1 are by far the most common (though
not the default).

It makes a lot of sense, performance wise, to special case
them.

Specifically, the sixel_add() function benefits greatly from this, as
it is the inner most, most heavily executed function when parsing a
sixel image.

sixel_add_many() also benefits, since allows us to drop a
multiplication. Since sixel_add_many() always called first (no other
call sites call sixel_add() directly), this has a noticeable effect on
performance.

Another thing that helps (though not as much), and not specifically
with AR 1:1 images, is special casing DECGRI a bit.

Up until now, it simply updated the current sixel parameter value. The
problem is that the default parameter value is 0. But, a value of 0
should be treated as 1. By adding a special ‘repeat_count’ variable to
the sixel struct, we can initialize it to ‘1’ when we see DECGRI, and
then simply overwrite it as the parameter value gets updated. This
allows us to drop an if..else when emitting the sixel.
2023-06-29 15:40:00 +02:00
Daniel Eklöf
a44a0b4ebe
Merge branch 'fractional-scaling' 2023-06-29 15:38:42 +02:00
Daniel Eklöf
ce31cc518a
wayland: surface_scale(): reset buffer scale when using fractional scaling
Since the first frame uses legacy scaling, the surface may have a
buffer scale > 1, which isn’t allowed.
2023-06-29 15:38:24 +02:00
Daniel Eklöf
c61247f317
wayland: surface_scale(): improve debug logging 2023-06-29 15:38:24 +02:00