Commit graph

5893 commits

Author SHA1 Message Date
Daniel Eklöf
fdd753263b
term: destroy: unref key bindings *after* destroying window
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()
2023-07-18 18:26:28 +02:00
Daniel Eklöf
27b4c2ac2d
themes: starlight: update to V4
This also updates the default theme in foot, as well as the
documentation.

Closes #1409
2023-07-18 16:20:33 +02:00
Daniel Eklöf
023a1b8da6
changelog: crash on pointer capability loss 2023-07-18 16:12:43 +02:00
xdavidwu
0b8791d1c5
wayland: fix pointer cap lost handling
Before this, on compositor without cursor-shape support, a pointer
capability lost of the seat makes foot crash.
2023-07-18 16:09:31 +02:00
Daniel Eklöf
e6d1e0cc27
Merge branch 'scale-is-floating-point'
Closes #1404
2023-07-18 16:06:37 +02:00
Daniel Eklöf
4a4f2b5dae
pgo: add stub for wayl_fractional_scaling() 2023-07-18 05:48:22 +02:00
Daniel Eklöf
df96b7f4c0
changelog: wrong DPI, and wrong initial font size with fractional scaling 2023-07-18 05:48:21 +02:00
Daniel Eklöf
5b3b89cb64
changelog: monitor metadata is now picked from the one we were last mapped on 2023-07-18 05:48:02 +02:00
Daniel Eklöf
7fca81dd3f
term: get_font_subpixel(): use subpixel from monitor we were *last* mapped on 2023-07-18 05:48:02 +02:00
Daniel Eklöf
21d99f8dce
terminal: break out scaling factor updating, and reduce number of calls to render_resize()
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.
2023-07-18 05:48:01 +02:00
Daniel Eklöf
c96863b188
wayland: error out if there aren’t any monitors available 2023-07-18 05:48:01 +02:00
Daniel Eklöf
b2a29280cb
wayland: use physical DPI on fractional-scale capable compositors
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*).
2023-07-18 05:48:01 +02:00
Daniel Eklöf
59f0a721c4
wayland: fractional_scale_preferred_scale(): only push update if scale has changed
Also, drop wl_window::have_preferred_scale. Check for scale > 0 instead.
2023-07-18 05:48:01 +02:00
Daniel Eklöf
829353a5da
term: font_dpi_changed: scale (and old_scale) are floating point
This should fix an issue where the font size wasn’t updated when
moving the window between outputs whose scaling factors match when
truncated.
2023-07-18 05:48:01 +02:00
Daniel Eklöf
2fd29cbf50
term: (debug): dpi_aware is no longer an enum 2023-07-18 05:48:01 +02:00
Ayush Agarwal
da81b63ec0
themes: add chiba-dark theme 2023-07-18 05:46:00 +02:00
Daniel Eklöf
6de69aa9b7
render: fix xcursor scaling with fractional-scale-v1
This worked just after the fractional-scaling branch was merged, but
was then broken by the cursor-shape branch, due to a bad rebase of
that branch.
2023-07-18 05:44:17 +02:00
CismonX
8b4cb2457a
input: do not ignore touch events on the CSDs 2023-07-16 20:41:33 +08:00
Ronan Pigott
b7100d5716 render: use rounding for fractional scale
If we truncate the buffer dimensions we may accidentally submit a
buffer with inappropriate size.
2023-07-15 20:03:16 -07:00
Daniel Eklöf
d1df98e0ca
changelog: add new ‘unreleased’ section 2023-07-14 12:40:55 +02:00
Daniel Eklöf
bee4a96b45
Merge branch 'releases/1.15' 2023-07-14 12:40:35 +02:00
Daniel Eklöf
5a3706ac46
meson: bump version to 1.15.0 2023-07-14 12:26:03 +02:00
Daniel Eklöf
53b0eb8e1b
changelog: prepare for 1.15.0 2023-07-14 12:25:16 +02:00
Daniel Eklöf
3f7be59062
config: add csd.double-click-to-maximize=no|yes option
When enabled, double-clicking the CSD titlebar will (un)maximize the
window.

Defaults to ‘yes’ (since this is the old hard-coded behavior).

Closes #1293
2023-07-14 12:03:35 +02:00
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