Commit graph

5954 commits

Author SHA1 Message Date
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
Daniel Eklöf
8f74b1090a
wayland: use legacy scaling until fractional_scale::preferred_scale() has been called
This way, the initial frame is more likely to get scaled correctly;
foot will guess the initial (integer) scale from the available
monitors, and use that. By using legacy scaling, we force the
compositor to down-scale the image to the correct scale factor.

If we use the new fraction scaling method with an integer scaling
factor, the initial frame gets rendered way too big.
2023-06-29 15:38:24 +02:00
Daniel Eklöf
d71e588800
wayland: refactor: surface_scale(): pass wl_window pointer, instead of wayland global 2023-06-29 15:38:24 +02:00
Daniel Eklöf
c309c9f572
wayland: surface_scale(): assert surface width/height is a multiple of scale
When doing legacy scaling (non-fractional scaling), assert the
surface’s width and height are multiples of the (integer) scale.
2023-06-29 15:38:24 +02:00
Daniel Eklöf
8a4efb3427
wayland: warn when fractional scaling isn’t available 2023-06-29 15:38:24 +02:00
Daniel Eklöf
9db92bd942
feature: add a feature flag (for --version) for fractional scaling 2023-06-29 15:38:24 +02:00
Daniel Eklöf
27a92b1158
changelog: dpi-aware’s default value is now ‘no’ 2023-06-29 15:38:23 +02:00
Daniel Eklöf
64b6b5d2a7
config: dpi-aware: remove ‘auto’ value, and default to ‘no’
We now default to scaling fonts using the scaling factor, not monitor
DPI.

The ‘auto’ value for dpi-aware has been removed.

Documentation (man pages and README) have been updated to reflect the
new default.
2023-06-29 15:38:23 +02:00
Daniel Eklöf
32b8c5c9b6
changelog: mention the newly added support for fractional-scaling-v1 2023-06-29 15:38:23 +02:00
Daniel Eklöf
0bdb6580bd
wayland: update terminal when preferred scaling factor changes
When the window’s preferred scaling factor is changed (through the
fractional-scaling protocol), update the terminal; resize font, resize
sub-surfaces etc.
2023-06-29 15:38:23 +02:00
Daniel Eklöf
8ccabb7974
wayland: surface_scale(): implement fractional scaling
This is done by setting the surface’s viewport destination
2023-06-29 15:38:23 +02:00
Daniel Eklöf
36818459e5
wayland: initialize window scale to -1 2023-06-29 15:38:23 +02:00
Daniel Eklöf
e5989d81b9
wayland: instantiate+destroy viewport for pointer surface 2023-06-29 15:38:23 +02:00
Daniel Eklöf
5a60bbc119
wayland: refactor: add a buffer argument to wayl_*_scale() functions
This will be needed later, when using fractional scaling + viewporter
to scale.
2023-06-29 15:38:23 +02:00
Daniel Eklöf
434fd6aa1f
wayland: refactor: wayl_surface_scale(): pass wayl_surface pointer
Instead of passing a raw wl_surface pointer, pass a wayl_surface
pointer.

This is needed later, when using fractional scaling to scale the
surface (since then we need the surface’s viewport object).
2023-06-29 15:38:23 +02:00
Daniel Eklöf
ba46a039ac
wayland: refactor: wrap wl_surface pointers in a wayl_surface struct
And add a viewport object to accompany the surface (to be used when
scaling the surface).

Also rename the wl_surf_subsurf struct to wayl_sub_surface, and add a
wayl_surface object to it, rather than a plain wl_surface pointer (to
also get the viewport pointer).
2023-06-29 15:38:23 +02:00