Commit graph

241 commits

Author SHA1 Message Date
Daniel Eklöf
f0887df5c5
main: bug: -t requires an argument 2020-02-15 21:05:53 +01:00
Daniel Eklöf
82b8853f17
main: add --print-pid=FILE|FD
When specified, our PID is written to the specified file (or FD),
after we've successfully started up.
2020-02-05 19:54:16 +01:00
Daniel Eklöf
00d76784f4
main: add --print-pid=FILE|FD
When specified, our PID is written to the specified file (or FD),
after we've successfully started up.

Only applicable in server mode.
2020-02-05 19:53:50 +01:00
Daniel Eklöf
8f4ec9aa47
Implement --hold
When specified, we don't exit when the slave/client process exits.
2020-02-03 19:58:32 +01:00
Daniel Eklöf
99f471d738
render: trigger terminal refreshes in an FDM hook
In some cases, we end up calling render_refresh() multiple times in
the same FDM iteration. This means will render the first update
immediately, and then set the 'pending' flag, causing the updated
content to be rendered in the next frame.

This can cause flicker, or flashes, since we're presenting one or more
intermediate frames until the final content is shown.

Not to mention that it is inefficient to render multiple frames like
this.

Fix by:

* render_refresh() only sets a flag in the terminal

* install an FDM hook; this hook loops all terminals and executes what
  render_refresh() _used_ to do (that is, render immediately if we're
  not waiting for a frame callback, otherwise set 'pending' flag). for
  all terminals that have the 'refresh_needed' flag set.
2020-01-04 19:49:26 +01:00
Daniel Eklöf
b100a82c2a
wayland: only bind to 'presentation' interface if -p,--presentation-timings 2019-12-31 16:12:48 +01:00
Daniel Eklöf
5a07419096
wayland: optionally use the presentation time protocol to measure input lag
This adds a flag, -p,--presentation-timings, that enables input lag
measuring using the presentation time Wayland protocol.

When enabled, we store a timestamp when we *send* a key to the
slave. Then, when we commit a frame for rendering to the compositor,
we request presentation feedback. We also store a timestamp for when
the frame was committed.

The 'presented' callback then looks at the input and commit
timestamps, and compares it with the presented timestamp.

The delay is logged at INFO when the delay was less than one frame
interval, at WARN when it was one frame interval, and at ERR when it
was two or more frame intervals.

We also update statistic counters that we log when foot is shut down.
2019-12-31 15:39:40 +01:00
Daniel Eklöf
ea1d072f52
main: let getopt_long() print error message 2019-12-29 18:35:06 +01:00
Daniel Eklöf
58a7ab76ba
main: third member in "struct option" is a pointer 2019-12-29 18:27:31 +01:00
Daniel Eklöf
67bacc2a94
main: use a single printf() when printing usage 2019-12-29 18:26:29 +01:00
Daniel Eklöf
39146fac5c
term: term_init: add 'cwd' argument
This is used when spawning the slave, to set its current working
directory just before we exec() the client.

In a regular foot instance, we set the cwd from getcwd().

In a foot server instance, each connecting client sends its cwd to the
server, and we use that.
2019-12-21 19:57:28 +01:00
Daniel Eklöf
a484a65fef
term: term_spawn_new: always spawn foot/footclient from PATH 2019-12-21 15:29:42 +01:00
Daniel Eklöf
57de9feaa5
term: term_spawn_new(): new function, spawns a new foot/footclient process
Bind ctrl+shift+return to it
2019-12-21 15:27:17 +01:00
Daniel Eklöf
4c924ab14a
main: verify locale is UTF-8 2019-12-19 07:25:05 +01:00
Daniel Eklöf
caa76bcdea
config: enable user to specify path to configuration file 2019-12-17 19:08:43 +01:00
Daniel Eklöf
d15631e3de
main: remove unused macros 2019-12-17 19:08:04 +01:00
Daniel Eklöf
a0fcec3a3d
log: caller can control syslog level 2019-12-17 19:07:28 +01:00
Daniel Eklöf
44f24b01bc
main: allow server socket path to be set on the command line
This adds an optional argument to -s,--server that allows the user to
override the default socket path (XDG_RUNTIME_DIR/foot.sock).
2019-12-14 12:59:54 +01:00
Daniel Eklöf
bafe7cab28
main: stop initializing a default set of fonts 2019-12-04 22:01:39 +01:00
Daniel Eklöf
e9fbb371df
fcft: font_from_name() no longer accepts a tllist 2019-12-01 19:22:25 +01:00
Daniel Eklöf
30335ef32a
fcft: include <fcft/fcft.h>, and use fcft/stride.h instead of local copy 2019-12-01 14:03:24 +01:00
Daniel Eklöf
fd9c28464d
fcft: use fcft instead of local copy of font.c/font.h 2019-12-01 13:43:51 +01:00
Daniel Eklöf
ae91c53fb2
font: pass dpi=96 to fontconfig
TODO: use actual output PPI. Question is *which* output...
2019-11-26 19:02:35 +01:00
Daniel Eklöf
55a23a5b29
log: set syslog facility to LOG_DAEMON when run in server mode 2019-11-20 19:43:31 +01:00
Daniel Eklöf
4f4ee5b39d
main: mention why we initialize a font set
Since fonts are destroyed and removed from the font cache when the
last instance is destroyed, closing the "last" terminal window in
server mode would destroy the fonts, and their glyph caches.

By instantiating the set in main, we ensure the fonts, and the glyph
caches, remain. This makes launching new terminals (much) faster.

Note that in "normal" (non-server) mode, this isn't really necessary,
but also doesn't have any penalty.
2019-11-20 19:27:16 +01:00
Daniel Eklöf
3c8a87168a
fonts: use 'weight' and 'slant', not 'style' when loading fonts 2019-11-19 17:35:02 +01:00
Daniel Eklöf
15b12f45c6
scan-build: fix a couple of minor warnings from a scan-build run 2019-11-05 10:39:36 +01:00
Daniel Eklöf
1c7fb2869d
main: destroy cached SHM buffers *after* terminals have been destroyed 2019-11-05 09:30:24 +01:00
Daniel Eklöf
567989e9f3
main: usage for --server now hints about 'footclient' 2019-11-03 13:46:09 +01:00
Daniel Eklöf
61dfa1365e
slave: restore signals before calling exec() 2019-11-03 13:24:15 +01:00
Daniel Eklöf
d26c67e589
main: ignore SIGHUP in master process 2019-11-03 13:23:49 +01:00
Daniel Eklöf
32129083bd
main: pre-allocate fonts
Since fonts are cached, this adds no additional memory. However, it
makes the first terminal window in --server mode start much faster,
since the (primary) fonts have already been loaded.

Fallback fonts are still loaded on-demand.
2019-11-02 13:50:40 +01:00
Daniel Eklöf
0bd2ddd8ad
term_init(): initialize slave TERM from term_init() argument 2019-11-01 21:03:08 +01:00
Daniel Eklöf
69d62d3cd2
slave: set TERM environment variable in slave process 2019-11-01 21:01:15 +01:00
Daniel Eklöf
a1efd65746
server: implement a --server mode
In this mode, foot listens on a UNIX socket and creates terminal
windows when clients connect.

A connecting client sends argc/argv to the server, and the server
instantiates a new terminal window.

When the terminal window is closed, the exit code is sent back to the
client.
2019-11-01 20:39:09 +01:00
Daniel Eklöf
32c6ed7069
main: register signal handlers for SIGINT and SIGTERM 2019-11-01 20:36:55 +01:00
Daniel Eklöf
1e41a25f00
terminal: call user-defined callback when destroying terminal
main uses this to get the exit code of the terminal.
2019-11-01 20:34:32 +01:00
Daniel Eklöf
291a928a49
render: call wl_display_flush() after rendering
This allows us to remove that call from the main event loop.
2019-11-01 20:01:36 +01:00
Daniel Eklöf
b7546abca9
main: get exit value from wayland struct 2019-10-30 20:26:08 +01:00
Daniel Eklöf
445bbe3469
wayland: track multiple terminals
The wayland 'term' member is gone and replaced by a list,
'terms'. This list contains all currently running terminal (windows).
2019-10-30 20:02:06 +01:00
Daniel Eklöf
a853896715
main: free 'config' on command line parse error 2019-10-30 18:06:47 +01:00
Daniel Eklöf
fe974956b0
term: integrate directly with FDM 2019-10-28 18:35:16 +01:00
Daniel Eklöf
0979a0e2e5
terminal: implement term_init() and term_destroy() 2019-10-28 18:25:19 +01:00
Daniel Eklöf
664641104c
main: remove a couple of includes 2019-10-27 19:28:23 +01:00
Daniel Eklöf
3684547fd7
main: kbd repeat FD is handled by the wayland backend 2019-10-27 19:23:22 +01:00
Daniel Eklöf
4a63defeb1
wayland: backend now configures FD as non-blocking, not main 2019-10-27 19:21:36 +01:00
Daniel Eklöf
2eaa258e11
main: cleanup 2019-10-27 19:21:27 +01:00
Daniel Eklöf
251cf98388
wayland: move keyboard repeat handling into wayland 2019-10-27 19:16:12 +01:00
Daniel Eklöf
1e75b89552
wayland: integrate directly with the FDM 2019-10-27 19:11:35 +01:00
Daniel Eklöf
61cc8c3c55
wayland: implement wayl_init()
Wayland instantiation is now done by the wayland backend, not in main.
2019-10-27 19:08:48 +01:00