Commit graph

3199 commits

Author SHA1 Message Date
Daniel Eklöf
c6a53d5e33
meson/pkgbuild: bump version to 1.6.2 2020-12-21 15:58:25 +01:00
Daniel Eklöf
7c3cb008ec
changelog: prepare for 1.6.1 2020-12-21 13:50:27 +01:00
Daniel Eklöf
b6b565cc9a
changelog: mention -Wno-profile-instr-unprofiled 2020-12-21 13:50:06 +01:00
Daniel Eklöf
1ad63a5c58
changelog: mention --seed in in generate-alt-random.pu 2020-12-21 13:47:45 +01:00
Daniel Eklöf
68dd9c17d5
generate-alt-random: ioctl(TIOCGWINSZ) may fail in run inside a container
This _should_ only happen when we’re doing a partial PGO build, since
then the script is run in the parent terminal. In this case, the user
is expected to use --rows/--cols anyway.
2020-12-21 13:42:59 +01:00
Daniel Eklöf
6a03567490
install: remove -march=native
This simplifies the instructions. People interested in performance are
likely to know how to use it.
2020-12-21 13:02:58 +01:00
Daniel Eklöf
84fe48acbb
install.md: mention that packagers should not use -march=native 2020-12-21 13:02:54 +01:00
Daniel Eklöf
69836ab795
install.md: add -Wno-profile-instr-unprofiled to clang flags in PGO builds 2020-12-21 13:02:51 +01:00
Daniel Eklöf
505680087c
changelog: use -std=c11 instead of -std=c18 2020-12-21 12:28:29 +01:00
sterni
5987b7c85f
meson: default to c11
We don't need any C18 specifics, so C11 is also fine and more widely
supported (i. e. in older clang versions).
2020-12-21 12:27:25 +01:00
Daniel Eklöf
82d9fd9219
install: fix typo in ‘ninja’ 2020-12-21 12:27:22 +01:00
Daniel Eklöf
fbe9f54db0
changelog: update ‘contributors’ 2020-12-20 15:49:24 +01:00
Daniel Eklöf
533db90a94
changelog: remove trailing ‘5’ 2020-12-20 15:48:25 +01:00
Daniel Eklöf
e12a9347dd
generate-alt-random: override detected width/height when --cols/--rows have been used
This ensures we have a valid width and height, that matches what the
PGO helper binary expects.
2020-12-20 15:46:46 +01:00
Daniel Eklöf
983f474ec8
generate-alt-random: fix “new style” cube escape
It’s “38:5:<idx>”, not “38:2:5:<idx>”.
2020-12-20 15:46:43 +01:00
sterni
d1735ffb6d
generate-alt-random-writes: use python random, allow setting a seed
Using Python's own PRNG should make the code cleaner and allow for
reproducible stimulus files if that is desired via setting --seed (at
least for the same versions of the script, changing the kind and/or
order of the random calls will of course impact the output in the
future).

I did the following substitutions:

* rand.read(1)[0] % n and struct.unpack('@H', rand.read(2))[0] % n →
  random.randrange(n)
* rand.read(1)[0] → random.randrange(256)
* rand.read(n) → [random.randrange(256) for _ in range(n)]
  (better alternative would have been random.randbytes(n), but is only
  available for Python >= 3.9, switching to this in the future will
  impact output)
* list[rand.read(1) % len(list)] → random.choice(list)
2020-12-20 15:46:40 +01:00
Daniel Eklöf
a2ce0622c5
render: fix rounding error when calculating background color with alpha
We use pre-multiplied alpha color channels, but were having bad
rounding errors due to the alpha divider being truncated to an
integer.

The algorithm for pre-multiplying a color channel is:

  alpha_divider = 0xffff / alpha
  pre_mult_color = color / alpha_divider

In order to fix the rounding errors, we could turn ‘alpha_divider’
into a double.

That however would introduce a performance penalty since now we’d need
to do floating point math for each cell.

The algorithm can be trivially converted to:

  pre_mult_color = color * alpha / 0xffff

Since both color and alpa values are < 65536, the multiplication is
“safe”; it will not overflow an uint32_t.

Closes #249
2020-12-20 15:46:32 +01:00
Daniel Eklöf
06f84b9aaf
meson: add wl_proto_headers to pgo executable
This fixes a build failure of pgo.o
2020-12-20 15:46:28 +01:00
Daniel Eklöf
3fd60d4975
changelog: mention meson dependency fix 2020-12-20 15:46:24 +01:00
Daniel Eklöf
b976d10f7d
changelog: add 1.6.1 section 2020-12-20 15:46:05 +01:00
Craig Barnes
18b027f26b
meson: add missing "wl_proto_headers" dependency for pgolib and vtlib
Dependency chains:

* pgolib -> terminal.c -> terminal.h -> wayland.h
* vtlib -> csi.c -> config.h -> wayland.h

wayland.h includes <primary-selection-unstable-v1.h>, which must be
generated by a custom_target() rule *before* any sources that require
it are built. Failure to fully specify these dependencies can otherwise
result in a race condition, where a dependent source file gets compiled
(and fails with a "header not found" error) before the header itself
has been generated.
2020-12-20 15:44:20 +01:00
Craig Barnes
9e7d108afd
changelog: fix link to "1.6.0" heading 2020-12-20 15:44:09 +01:00
Daniel Eklöf
eadc1c58a2
term: fix builds with debug logging enabled
DPI_AWARE_ON has been renamed to DPI_AWARE_YES
2020-12-20 15:43:26 +01:00
Daniel Eklöf
098a7e42cb
meson/pkgbuild: bump version to 1.6.0 2020-12-18 14:52:10 +01:00
Daniel Eklöf
8cc179cc53
changelog: prepare for 1.6.0 2020-12-18 14:51:34 +01:00
Daniel Eklöf
59e4243f2a
changelog: move entry for dpi-aware up, to make it more visible 2020-12-18 14:46:56 +01:00
Daniel Eklöf
c1dc38e813
changelog: use code/monospace highlighting for foot.ini config options 2020-12-18 14:46:16 +01:00
Daniel Eklöf
5c59e38cf4
Merge branch 'dpi-aware-when-scaling-factor-is-one' 2020-12-18 14:42:48 +01:00
Daniel Eklöf
397154bd4e
Merge branch 'statusline-terminfo-caps'
Closes #242
2020-12-18 14:41:31 +01:00
Daniel Eklöf
fa93a97a08
terminfo: add status line capabilities: hs, dsl, fsl and tsl
* hs  - boolean, signals status line availability
* tsl - to_status_line: begin an OSC 2 sequence (set window title)
* fsl - from_status_line: OSC terminator
* dsl - disable status line: \E]2;\E\\ - clears the window title

Closes #242
2020-12-18 13:46:57 +01:00
Daniel Eklöf
34fe1e3f81
Merge branch 'gruvbox-light' 2020-12-17 12:37:23 +01:00
Daniel Eklöf
57e535908d
readme: describe the new font sizing behavior 2020-12-17 12:19:13 +01:00
Daniel Eklöf
0a821f2ed4
fonts: size fonts using the scaling factor when output scaling is enabled
This extends the new ‘dpi-aware’ option with a new default value,
‘auto’.

When set to ‘auto’, fonts are sized using monitors’ DPI when output
scaling is disabled. When output scaling is enabled, fonts are instead
sized using the scaling factor.

The reasoning here is that a user that has enabled output scaling is
obviously *not* relying on DPI scaling.

Output scaling can also be a way to compensate for different viewing
distances, in which case we do *not* want to break that by using DPI
scaling.

Users can still force DPI-only font sizing by setting ‘dpi-aware=yes’,
or disable it completely by setting ‘dpi-aware=no’.
2020-12-17 12:05:22 +01:00
AdrienLeGuillou
24131a896f Add a gruvebox-light theme 2020-12-17 09:25:53 +01:00
Daniel Eklöf
69cd5fd3ab
vt: codespell: ony -> only 2020-12-16 15:06:34 +01:00
Daniel Eklöf
2e137c0a7e
vt: don’t ignore extra private/intermediate characters
Take ‘\E(#0’ for example - this is *not* the same as ‘\E(0’.

Up until now, foot has however treated them as the same escape,
because the handler for ‘\E(0’ didn’t verify there weren’t any _other_
private characters present.

Fix this by turning the ‘private’ array into a single 4-byte
integer. This allows us to match *all* privates with a single
comparison.

Private characters are added to the LSB first, and MSB last. This
means we can check for single privates in pretty much the same way as
before:

  switch (term->vt.private) {
  case ‘?’:
      ...
      break;
  }

Checking for two (or more) is much uglier, but foot only supports
a *single* escape with two privates, and no escapes with three or
more:

  switch (term->vt.private) {
  case 0x243f:  /* ‘?$’ */
      ...
      break;
  }

The ‘clear’ action remains simple (and fast), with a single write
operation.

Collecting privates is potentially _slightly_ more complex than
before; we now need mask and compare, instead of simply comparing,
when checking how many privates we already have.

We _could_ add a counter, which would make collecting privates easier,
but this would add an additional write to the ‘clean’ action which is
really bad since it’s in the hot path.
2020-12-16 14:30:49 +01:00
Daniel Eklöf
db097891f2
csi: implement DECRQM (DEC modes), for real
Previously, we always returned ‘2 - reset’, instead of the actual
state of the requested mode.
2020-12-16 13:57:40 +01:00
Daniel Eklöf
37f036f9e9
changelog: ECMA-4*8* 2020-12-16 10:33:04 +01:00
Daniel Eklöf
066b2297ef
changelog: group ‘bell’ entries together 2020-12-16 10:32:21 +01:00
Daniel Eklöf
3744c09b35
readme: add link to IRC channel log 2020-12-16 10:31:09 +01:00
Daniel Eklöf
0d6b5f522e
config_font_parse(): return fail/success 2020-12-15 18:55:27 +01:00
Daniel Eklöf
04703c07f0
csi: SGR 21 is “double underline”, not “disable bold” (according to ECMA-48) 2020-12-14 19:10:30 +01:00
Daniel Eklöf
6c8b034aff
term: enabling application synchronized updates clear pending grid refresh
This fixes issues with de-synchronized frames being rendered; we may
have scheduled a redraw earlier, that hasn’t yet triggered (probably
because we’re waiting for a frame callback), when we enable
application synchronized updates.

This means we risk rendering a partially updated state when the frame
callback finally arrives, if the application hasn’t yet ended its
synchronized update.
2020-12-14 19:05:54 +01:00
Daniel Eklöf
602dbdb9f6
input: make sure ‘surf_kind’ is not uninitialized 2020-12-12 21:10:28 +01:00
Daniel Eklöf
9f321e6030
csi: fix sub-parameter versions of 38/48 SGR escapes
Well this is embarrassing; the sub-parameter versions of the 38/48 SGR
escapes all required an extra ‘:2’ that wasn’t supposed to be there,
causing all the other sub-parameters to be shifted one step to the
right.

That is, foot expected e.g. 38:2:2:r:g:b, or 38:2:5:idx when the
correct sequences are 38:2:cs:r:g:b and 38:5:idx.

I.e. I mixed up the color-space ID (cs) of 38:2 with *type* of color:
RGB or indexed.

In addition to fixing this, this patch also adds support for a
“bastard” version of the sub-parameter based RGB escapes, where the
color-space identifier has been left out: e.g. 38:2:r:g:b. This
sequence is invalid, but applications tend to “forget” the color-space
ID...
2020-12-12 20:55:31 +01:00
Daniel Eklöf
ff96ce1e91
input: rework mouse button/motion handling
Store a list of currently pressed buttons, and which surface they
belong to (i.e. which surface that received the press).

Then, in motion events (with a button pressed, aka drag operations),
send the event to the “original” surface (that received the press).

Also send release events to the originating surface.

This means a surface receiving a press will always receive a
corresponding release. And no one will receive a release event without
a corresponding press event.

Motion events with a button pressed will *always* use the *first*
button that was pressed. I.e. if you press a button, start dragging,
and then press another button, we keep generating motion events for
the *first* button.
2020-12-12 19:05:24 +01:00
Daniel Eklöf
a1a0b489ee
input: report mouse drag events also when the pointer is outside the grid
As long as the mouse button was *pressed* while the pointer was inside
the grid, we want to keep reporting motion events until the button is
released.

Even when the pointer moves outside the grid (but in this case, the
reported coordinates are bounded by the grid size).

This patch also tries to improve multi-button handling (i.e. multiple
buttons pressed at the same time), and the events we report to the
client for these, in the following ways:

* Motion events now report the *initial* button. That is, if you start
  a drag operation with the LEFT button, then press RIGHT (before
  releasing LEFT), keep reporting LEFT in the motion events.
* Mouse release events are reported for *any* button, as long as the
  pointer is *inside* the grid, *or*, the button released was the
  button used to start a drag operation.

The last point is important; if we have reported a button press
followed by motion events (i.e. a drag operation), we need to report
the button release, *even* if the pointer is outside the grid.

Note that the client may receive unbalanced button press/release
events in the following ways if the user pressed one, and then a
second button *inside* the grid, then releases the *first*
button (possibly outside the grid), and finally releases the *second*
button *outside* the grid.

In this case, both buttons will report press events. The first button
will report a release event since it is the initial button in the drag
operation.

However, we don’t track the fact that the second button is being
pressed, and thus if it is released outside the grid, it wont generate
a release event.
2020-12-11 21:01:00 +01:00
Daniel Eklöf
975e70dae1
csi: ‘CSI s’ and ‘CSI u’ now saves/restores attributes and charsets 2020-12-11 20:01:19 +01:00
Daniel Eklöf
934466bc84
Merge branch 'osc777-notify'
Closes #224
2020-12-11 19:44:32 +01:00
Daniel Eklöf
15d20af2a2
config: add ‘notify’ to possible values for ‘bell’ in foot.ini
When `bell=notify`, foot will trigger a desktop notification when it
receives a BEL in an unfocused window.
2020-12-10 18:22:48 +01:00