Commit graph

280 commits

Author SHA1 Message Date
Jan Beich
fd4511a3dc
main: correct header for mode macros
main.c:13:10: fatal error: 'sys/sysinfo.h' file not found
 #include <sys/sysinfo.h>
          ^~~~~~~~~~~~~~~
main.c:122:28: error: use of undeclared identifier 'S_IRUSR'
                           S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
                           ^
main.c:122:38: error: use of undeclared identifier 'S_IWUSR'
                           S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
                                     ^
main.c:122:48: error: use of undeclared identifier 'S_IRGRP'
                           S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
                                               ^
main.c:122:58: error: use of undeclared identifier 'S_IROTH'
                           S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
                                                         ^
2021-01-23 10:16:09 +01:00
Craig Barnes
d2c00d73ec
Add xsnprintf() and remove some unnecessary strlen(3) calls 2021-01-21 11:57:46 +01:00
Daniel Eklöf
0d6b5f522e
config_font_parse(): return fail/success 2020-12-15 18:55:27 +01:00
Daniel Eklöf
77bc7c8b2c
features: include compile-time enable/disable state of features when printing version 2020-12-07 20:44:11 +01:00
Craig Barnes
adde947fc5 config: replace union in config struct with simple width/height members 2020-11-30 02:24:38 +00:00
Daniel Eklöf
addc374655
main: tag fdm loop with likely() and unlikely() 2020-11-26 18:23:28 +01:00
Daniel Eklöf
8eaa195990
foot/footclient: add short options to all command line options
e813883367 added “missing” short command
line options to footclient.

Except they weren’t missing; they were intentionally missing short
options and only supported long options.

This commit makes the new/missing short options “official”, by adding
documentation, zsh completions and including them in usage().
2020-11-23 19:19:19 +01:00
Daniel Eklöf
2928ef5fbe
main: remove trailing ‘, ’ from arch log line 2020-10-25 19:27:57 +01:00
Daniel Eklöf
2c101a21ee
config: add font-bold, font-italic and font-bold-italic options
These options lets the user configure custom fonts and styles, to use
with the bold and italic cell attributes.

By default, they are unset, meaning we use the bold/italic variants of
the regular font.

Closes #169.
2020-10-20 21:04:47 +02:00
Daniel Eklöf
4d17c23224
main: configure locale *before* loading the config
Without this, config_load() can’t use wide-character functions
properly.
2020-10-09 19:45:26 +02:00
Daniel Eklöf
51a7e44fa2
config: add tweak.scaling-filter
Use the new fcft_set_scaling_filter() API to use a non-default scaling
filter.

By default, we use lanczo3, the ‘best’ filter. This overrides the
default in fcft, which is ‘cubic’ filtering.
2020-09-13 17:59:56 +02:00
Daniel Eklöf
eb6737ca25
Add -W,--window-size-chars, and foot.ini:initial-window-size-chars
* Add -W,--window-size-chars command line option
* Add initial-window-size-chars foot.ini option
* Add -w,--window-size-pixels command line option
* Add initial-window-size-pixels foot.ini option
* Deprecate -g,--geometry command line option in favor of
  -w,--window-size-pixels
* Deprecate geometry option in foot.ini in favor of
  initial-window-size-pixels
2020-09-08 19:41:00 +02:00
Daniel Eklöf
df35b09142
main: usage: footrc -> foot.ini 2020-08-27 20:03:30 +02:00
Daniel Eklöf
6f5f7f1411
main: include our own bitness when logging the architecture 2020-08-11 17:23:10 +02:00
Craig Barnes
7a77958ba2 Convert most dynamic allocations to use functions from xmalloc.h 2020-08-08 20:37:57 +01:00
Daniel Eklöf
5e26d3ef47
server/client: use $WAYLAND_DISPLAY instead of $XDG_SESSION_ID in default socket path
Foot is a Wayland client and cannot be run outside of a Wayland
session. As such, it makes more sense to use $WAYLAND_SESSION instead
of $XDG_SESSION_ID in the default socket path since this makes it
clearer which Wayland session we belong to.

Closes #55.
2020-08-02 13:10:31 +02:00
Daniel Eklöf
387e8de751
main: update --help with correct default path for -s,--server
I missed this in f3c301ee8b when fixing
2020-08-02 12:41:48 +02:00
Daniel Eklöf
b00dfcf7b6
config: configuration errors are no longer fatal
Instead of refusing to start foot on configuration errors, we start
and print a user-notification.
2020-07-31 17:07:14 +02:00
Daniel Eklöf
86e7cb04c4
main: add --check-config command line option 2020-07-29 17:48:22 +02:00
Daniel Eklöf
74c3b4be1a
main: free 'cwd' at exit
This fixes an issue where e.g. failing to initialize the Wayland
backend would leave cwd un-free:d
2020-07-13 14:17:55 +02:00
Daniel Eklöf
69e4213e4a
term: don't use deprecated fcft_size_adjust()
When resizing the font on-the-fly, we now do a complete
font-reload (this is basically what fcft_size_adjust() did anyway).

To get the correct size, we maintain the current size ourselves.

We get the initial size from the user-provided font pattern, by
converting the string to an FcPattern, and using FcPatternGet() to
retrieve both the FC_SIZE and FC_PIXEL_SIZE attributes. These
attributes are then removed from the pattern, and the pattern is
converted back to a string.

The terminal struct maintains a copy of the font sizes. These are
initially set to the sizes from the config.

When the user resizes the font, the terminal-local sizes are
adjusted. To ensure the primary and user-configured fallback fonts are
resizes equally much, convert any pixel sizes to point sizes at this
point.

When the font size is reset, we reload the font sizes from the
config (thus once again returning actual pixel-sizes, if that's what
the user has configured).
2020-07-07 10:44:55 +02:00
Daniel Eklöf
7fb2da3cf9
main: log architecture at startup 2020-06-09 20:35:21 +02:00
Daniel Eklöf
789617d5ad
term: don't double fork new terminal windows
Instead, register their PIDs with the new reaper module and let it
handle them.
2020-05-21 20:17:29 +02:00
Daniel Eklöf
f49742ebba
reaper: new module, uses a signalfd to wait() on child processes
Use a signalfd to listen for SIGCHLD signals.

When we receive a SIGCHLD over the signalfd, reap all dead children by
looping over all registered child PIDs and call waitpid(WNOHANG) on
them.
2020-05-21 20:15:10 +02:00
Daniel Eklöf
5b70f94827
main/client: be POSIXLY_CORRECT when parsing command line
This means command line parsing stops when it encounters the first
nonoption argument.

The result is that one no longer need to use '--' to ensure arguments
are passed to the shell/command, instead of parsed by foot.

That is, instead of

  foot -- sh -c true

one can now do

  foot sh -c true

Arguments to foot *must* go before the command:

  foot --fullscreen sh -c true
2020-05-08 18:43:03 +02:00
Daniel Eklöf
242bcb9550
main: only set LC_CTYPE
This is the only locale variable we need. This ensures LC_NUMERIC in
particular remains as "C", which is needed by fcft when instantiating
new fonts.
2020-04-29 20:09:41 +02:00
Daniel Eklöf
77af910330
main: log locale 2020-04-21 19:02:18 +02:00
Daniel Eklöf
ec7a768487
conf: add 'title' conf option and --title command line option 2020-04-01 19:59:47 +02:00
Daniel Eklöf
4d52a870b4
conf: add app-id config option and --app-id command line option 2020-04-01 18:40:51 +02:00
Daniel Eklöf
598ac4bcd0
Merge branch 'master' into scroll-damage-performance 2020-03-27 21:16:42 +01:00
Daniel Eklöf
758fd9fd58
client: add --maximized and --fullscreen
We now create a copy of the config for each client, and updates it
with the values passed from the client.

Since we're not actually cloning it (and e.g. strdup() all strings
etc) we can't call conf_destroy() to free it, but need to free just
the strings we've replaced.
2020-03-27 21:14:49 +01:00
Daniel Eklöf
728e23863c
foot: add --maximized and --fullscreen command line options 2020-03-26 19:47:00 +01:00
Daniel Eklöf
0baa249d8b
shm: make max pool size user configurable (via a 'tweak' setting) 2020-03-25 20:48:02 +01:00
Daniel Eklöf
ef5bacc618
main: log version at startup 2020-03-15 11:41:24 +01:00
Daniel Eklöf
c993148635
main: free config if we fail to load the config 2020-03-09 20:04:25 +01:00
Daniel Eklöf
eed5052ce8
main: check return value of getcwd() 2020-02-20 18:46:45 +01:00
Daniel Eklöf
b5efe984bb
slave: prefix argv[0] with a '-' when spawning a login-shell 2020-02-20 18:36:09 +01:00
Daniel Eklöf
6af4b87ec5
config: add 'login-shell' option 2020-02-20 18:35:10 +01:00
Daniel Eklöf
d3071b817e
main: add --login-shell command line option 2020-02-20 18:34:23 +01:00
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