Commit graph

83 commits

Author SHA1 Message Date
Daniel Eklöf
28c2bea800
osc: reset background alpha when resetting the background color 2021-04-08 10:41:39 +02:00
Daniel Eklöf
8020c14637
osc: parse_legacy_color(): the alpha component is not a floating point number
When using the urxvt extension of the XParseColor format, the alpha
component is not a floating point number, but a decimal number in the
range 0-100.
2021-04-08 10:41:38 +02:00
Daniel Eklöf
5ff655506d
osc: parse_rgb(): ensure ‘alpha’ has been initialized 2021-04-08 10:41:38 +02:00
Daniel Eklöf
ed41bffc28
osc: add support for URxvt extension to include alpha in OSC-11
There are two variants, either using a ‘[percent]’ prefix for legacy
colors, or using ‘rgba:r/g/b/a’ instead of ‘rgb:r/g/b’.

Closes #436
2021-04-08 10:41:38 +02:00
Daniel Eklöf
936063271f
config/terminal: refactor: remove “default_*” color members from terminal struct
Access the original colors in the configuration instead.
2021-04-07 08:07:43 +02:00
Daniel Eklöf
4f0c0628a2
osc: verify OSC 4/104 color index is valid
Closes #434
2021-04-05 21:13:32 +02:00
Daniel Eklöf
d44cda11bf
osc-8: fix thinko: can’t use the ID parameters *address* as actual ID
Doing so means the next OSC-8 URL emitted by the client application,
with the same ID, will get a *new* id internally.

Instead, hash the string and use that as ID.
2021-02-21 20:15:31 +01:00
Daniel Eklöf
b934969b85
term: add ‘id’ parameter to term_osc8_open()
The current OSC-8 URL’s ID is now tracked along with the URI itself,
and its starting point.
2021-02-21 20:14:52 +01:00
Daniel Eklöf
ecbfc2bbe9
osc: 8: parse params, and the ‘id’ parameter specifically
Applications can assign an ID to the URL. This is used to associate
the parts of a split up URL with each other:

  ╔═ file1 ════╗
  ║          ╔═ file2 ═══╗
  ║http://exa║Lorem ipsum║
  ║le.com    ║ dolor sit ║
  ║          ║amet, conse║
  ╚══════════║ctetur adip║
             ╚═══════════╝

In the example above, ‘http://exa’ and ‘le.com’ are part of the same
URL, but by necessity split up into two OSC-8 URLs.

If the application sets the same ID for those two OSC-8 URLs, the
terminal can ensure they are handled as one.
2021-02-21 20:14:52 +01:00
Daniel Eklöf
b55f6925d3
osc: parse OSC-8, by calling term_osc8_{open,close} as appropriate 2021-02-21 20:14:51 +01:00
Craig Barnes
e56136ce11 debug: rename assert() to xassert(), to avoid clashing with <assert.h> 2021-01-16 20:16:00 +00:00
Craig Barnes
3f4cfa338b Add xsnprintf() and remove some unnecessary strlen(3) calls 2021-01-14 21:30:06 +00:00
Daniel Eklöf
03cbb6ad90
notify: break out desktop notifications from osc.c 2020-12-10 18:06:24 +01:00
Daniel Eklöf
21cc68d49e
osc: implement urxvt’s “OSC 777;notify”
OSC 777 is URxvt’s generic escape to send commands to its perl
extensions. The first parameter is the name of the extension, followed
by its arguments.

OSC 777;notify is a, if not well established, at least a fairly well
known escape sequence to request a (desktop) notification. The syntax
is:

  \e]777;notify;<title>;<body>\e\\

Neither title nor body is escaped in any way, meaning they should not
contain a ‘;’.

Foot will split title from body at the *first* ‘;’. Any remaining ‘;’
characters are treated as part of ‘body’.

Instead of adding built-in support for the freedesktop notification
specification (which would require us to link against at least dbus),
add a new config option to foot.ini: ‘notify’.

This option specifies the command to execute when a notification is
received. ‘${title}’ and ‘${body}’ can be used anywhere, in any
combination, and as many times as you want, in any of the command
arguments.

The default value is ‘notify-send -a foot -i foot ${title} ${body}’
2020-12-09 20:54:51 +01:00
Daniel Eklöf
360cc8e6de
term: remove read-only properties copied from the config
Use the config directly instead.
2020-11-26 18:08:28 +01:00
Daniel Eklöf
cad0ae957d
osc: use new uri_parse() to parse an OSC7 PWD URI 2020-10-28 19:11:22 +01:00
Daniel Eklöf
b507d3a55e
osc: change info logging to debug logging when changing the cursor color 2020-10-20 21:03:51 +02:00
Daniel Eklöf
edb904a187
osc: don’t explicitly call render_refresh() when changing the color palette
Doing so will schedule the renderer “as soon as possible”. I.e we’re
by-passing the regular scheduler, and thus we’re by-passing the user’s
setting of the delayed-render-* timers.

The fact that we’re scheduling “as soon as possible” also means we’re
much more likely to trigger flickering, or color flashes, if the
application is changing colors which are on the screen.

To handle changes to the cursor color(s), use the new
term_damage_cursor() instead of render_refresh().

To handle background color changes, which affect the margins, use the
new term_damage_margins() instead of render_refresh_margins(),

Closes #141
2020-09-29 10:05:52 +02:00
Daniel Eklöf
419bd87098
osc52: use first source that actually *has* data 2020-09-09 19:01:42 +02:00
Daniel Eklöf
776b831d89
osc52: unset (clear) selection when an invalid payload is received 2020-09-09 19:01:39 +02:00
Daniel Eklöf
d579c0e1e4
osc: explicitly refresh margins on a background color change 2020-09-01 07:34:41 +02:00
Daniel Eklöf
aa3985a298
Don't use "case X ... Y:", if possible/where it makes sense 2020-08-23 10:07:08 +02:00
Daniel Eklöf
3e1636c013
osc: dirty grids on *all* color modifying sequences
We only updated the grid for OSC 4 - Set color <idx>. But we did *not*
do it for 104 (reset color <idx>), 10 - set default foreground, 11 -
set default background, 110 - reset default foreground, or 111 - reset
default background.
2020-08-18 17:54:11 +02:00
Craig Barnes
104fe2fa55 Fix some spelling mistakes 2020-08-15 19:39:00 +01:00
Craig Barnes
7a77958ba2 Convert most dynamic allocations to use functions from xmalloc.h 2020-08-08 20:37:57 +01:00
Craig Barnes
11a1d99da7 Replace non-portable "\e" escape in string literals with "\033" 2020-08-02 23:54:04 +01:00
Daniel Eklöf
71584aed38
seat: use separate 'enter' serials for keyboard and mouse 2020-07-09 11:20:46 +02:00
Daniel Eklöf
11373a6561
multi-seat: re-enable OSC 52 support 2020-07-08 19:28:08 +02:00
Daniel Eklöf
c470825067
wip: multi-seat support
Compiles and runs, but mouse, clipboard and other things have been
disabled.
2020-07-08 16:45:26 +02:00
Daniel Eklöf
c94cbdeb64
osc: set color: update both grids, but exclude scrollback 2020-06-14 09:34:46 +02:00
Daniel Eklöf
957e482f45
osc: 'Set Color' now updates already rendered cells in current grid
Since we don't have the original palette index in already rendered
cells, we compare the color *value*. If it matches, we assume this was
the color index used, and updates the cell's color.

Note that for performance reasons, we only update the current
grid. This is of course wrong, strictly speaking.

However, it is expected that _Set Color_ is used by full-screen
applications using the alternate grid.
2020-06-11 17:13:32 +02:00
Daniel Eklöf
f72c982c89
osc: don't assert on \E]4 being followed by a ';'
This fixes a crash (in debug builds) that could be triggered by
e.g. cat:ing /dev/urandom.
2020-06-09 17:33:26 +02:00
Daniel Eklöf
ae7383189a
osc: fix scaling of RGB formatted color specifiers 2020-05-02 23:07:26 +02:00
Daniel Eklöf
9eda632c97
osc: OSC 12: mimic xterm - a color value of 0 means use inverted fg/bg 2020-05-02 23:00:21 +02:00
Daniel Eklöf
db9b99e8ac
osc: fix 'OSC 12 ?' to return the cursor color, not the cursor text color 2020-05-02 22:58:30 +02:00
Daniel Eklöf
ac58d05c6b
osc: fix scaling of legacy formatted color specifiers 2020-05-02 22:57:12 +02:00
Daniel Eklöf
5b67e97fc2
osc 104: handle multiple indices the same way we do in OSC 4 - use strtok() 2020-04-04 14:30:50 +02:00
Daniel Eklöf
ae1b235eaa
osc: 4: handle multiple idx;spec pairs 2020-04-04 14:27:44 +02:00
Daniel Eklöf
7466e87a31
osc: ignore OSC 7 when hostname doesn't match our own hostname 2020-04-03 20:15:54 +02:00
Daniel Eklöf
5d702e6fbf
osc: implement OSC 12 and OSC 112 (set/reset text cursor color) 2020-01-20 18:36:19 +01:00
Daniel Eklöf
c3a23cf5b7
osc: implement OSC 7 - set PWD
OSC 7 updates the terminal's view of the current working
directory. The format is OSC 7;URI ST

We decode the URI and updates the term structs 'cwd' member.

This is then used when spawning a new terminal instance.
2019-12-21 19:42:59 +01:00
Daniel Eklöf
d6065ef659
osc: spell "#if 0" correctly 2019-12-19 19:55:52 +01:00
Daniel Eklöf
e7abd6ce97
osc: commented out beginning of OSC 777
I haven't decided if I want to support this
2019-12-19 07:28:10 +01:00
Daniel Eklöf
616896e2a5
csi/ocs/vt: log unhandled/unrecognized sequences as debug messages
Having them as error messages was nice when we where still missing
lots of sequences.

Now we don't anymore, and these just spam stdout as well as syslog
when e.g. cat:ing binary data.
2019-11-29 23:59:24 +01:00
Daniel Eklöf
b58fd1c205
osc 52: default to 'clipboard' if no source/target has been specified 2019-11-28 20:56:55 +01:00
Daniel Eklöf
1980345618
osc: copy to/from clipboard: alias 's' to 'p'
'p' means 'primary', while 's' means 'selection'. Thus, a client can
now request 'selection' clipboard data and will receive it from the
primary selection.
2019-11-19 14:05:31 +01:00
Daniel Eklöf
b15032d223
selection: text_from_{clipboard,primary}: add 'done' callback
This callback is *always* called, including when there has been an
error.

This is in preparation for making text_from_{clipboard,primary}
asynchronous.
2019-11-05 08:49:32 +01:00
Daniel Eklöf
9f1525aef7
Rename: vt_to_slave() -> term_to_slave() 2019-11-03 00:52:24 +01:00
Daniel Eklöf
1adab32906
term: wayland struct is now not a part of the terminal struct
We do however need access to it, so provide a pointer. The difference
is that now we can have a *single* wayland instance, but multiple
terminal instances.
2019-10-27 18:51:14 +01:00
Daniel Eklöf
9f0b1f94c2
wayland: change all wayland callbacks to take a wayland pointer
Instead of passing the terminal to the wayland callbacks, pass a
'struct wayland' pointer.
2019-10-27 18:43:07 +01:00