Commit graph

3436 commits

Author SHA1 Message Date
Jan Beich
f2ad02aaab
render: set thread name in a portable way
prctl is Linux-only but pthread_setname_np is same as PR_SET_NAME.
Solaris and FreeBSD >= 13 have pthread_setname_np similar to Linux.
DragonFly, OpenBSD, FreeBSD < 13 lack pthread_setname_np but provide
pthread_set_name_np which doesn't return a value. NetBSD requires 3
arguments for pthread_setname_np where the last one is void *.

render.c:8:10: fatal error: 'sys/prctl.h' file not found
 #include <sys/prctl.h>
          ^~~~~~~~~~~~~
render.c🔢9: error: implicit declaration of function 'prctl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (prctl(PR_SET_NAME, proc_title, 0, 0, 0) < 0)
        ^
render.c🔢15: error: use of undeclared identifier 'PR_SET_NAME'
    if (prctl(PR_SET_NAME, proc_title, 0, 0, 0) < 0)
              ^
2021-01-23 09:52:40 +01:00
Jan Beich
db9dc7e908
shm: unbreak build without memfd_create
New FreeBSD versions have memfd_create but other BSDs don't.

pgo/pgo.c:260:22: error: implicit declaration of function 'memfd_create' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
                     ^
pgo/pgo.c:260:52: error: use of undeclared identifier 'MFD_CLOEXEC'
        int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
                                                   ^
shm.c:13:10: fatal error: 'linux/mman.h' file not found
 #include <linux/mman.h>
          ^~~~~~~~~~~~~~
shm.c:277:15: error: implicit declaration of function 'memfd_create' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
              ^
shm.c:277:60: error: use of undeclared identifier 'MFD_CLOEXEC'
    pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
                                                           ^
shm.c:277:74: error: use of undeclared identifier 'MFD_ALLOW_SEALING'
    pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
                                                                         ^
shm.c:339:15: error: use of undeclared identifier 'F_SEAL_GROW'
              F_SEAL_GROW | F_SEAL_SHRINK | /*F_SEAL_FUTURE_WRITE |*/ F_SEAL_SEAL) < 0)
              ^
shm.c:339:29: error: use of undeclared identifier 'F_SEAL_SHRINK'
              F_SEAL_GROW | F_SEAL_SHRINK | /*F_SEAL_FUTURE_WRITE |*/ F_SEAL_SEAL) < 0)
                            ^
shm.c:339:71: error: use of undeclared identifier 'F_SEAL_SEAL'
              F_SEAL_GROW | F_SEAL_SHRINK | /*F_SEAL_FUTURE_WRITE |*/ F_SEAL_SEAL) < 0)
                                                                      ^
shm.c:338:24: error: use of undeclared identifier 'F_ADD_SEALS'
    if (fcntl(pool_fd, F_ADD_SEALS,
                       ^
2021-01-23 09:52:40 +01:00
Jan Beich
013e3c2d80
shm: disable fallocate optimization if not supported
shm.c:301:26: error: implicit declaration of function 'fallocate' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        can_punch_hole = fallocate(
                         ^
shm.c:302:22: error: use of undeclared identifier 'FALLOC_FL_PUNCH_HOLE'
            pool_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1) == 0;
                     ^
shm.c:302:45: error: use of undeclared identifier 'FALLOC_FL_KEEP_SIZE'
            pool_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1) == 0;
                                            ^
shm.c:432:9: error: implicit declaration of function 'fallocate' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (fallocate(
        ^
shm.c:434:13: error: use of undeclared identifier 'FALLOC_FL_PUNCH_HOLE'
            FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
            ^
shm.c:434:36: error: use of undeclared identifier 'FALLOC_FL_KEEP_SIZE'
            FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                                   ^
shm.c:501:9: error: implicit declaration of function 'fallocate' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (fallocate(
        ^
shm.c:503:13: error: use of undeclared identifier 'FALLOC_FL_PUNCH_HOLE'
            FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
            ^
shm.c:503:36: error: use of undeclared identifier 'FALLOC_FL_KEEP_SIZE'
            FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                                   ^
shm.c:597:9: error: implicit declaration of function 'fallocate' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (fallocate(
        ^
shm.c:599:13: error: use of undeclared identifier 'FALLOC_FL_PUNCH_HOLE'
            FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
            ^
shm.c:599:36: error: use of undeclared identifier 'FALLOC_FL_KEEP_SIZE'
            FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                                   ^
2021-01-23 09:52:40 +01:00
Jan Beich
e35e98ea94
shm: silence -Wunused-function on i386
shm.c:134:1: error: unused function 'page_size' [-Werror,-Wunused-function]
page_size(void)
^
2021-01-23 09:52:40 +01:00
Jan Beich
67e713ff3a
slave: skip e310487dae if not supported
slave.c:188:26: error: use of undeclared identifier 'IUTF8'
        flags.c_iflag |= IUTF8;
                         ^
2021-01-21 12:00:02 +01:00
Jan Beich
c531c6bc0e
uri: switch to conservative maximum hostname length
Current maximum is provided by sysconf(_SC_HOST_NAME_MAX) instead.

uri.c:269:20: error: use of undeclared identifier 'HOST_NAME_MAX'
    char this_host[HOST_NAME_MAX];
                   ^
2021-01-21 12:00:02 +01:00
Jan Beich
ce7df7cc1f
terminal: add/exclude missing headers
terminal.c:3:10: fatal error: 'malloc.h' file not found
 #include <malloc.h>
          ^~~~~~~~~~
terminal.c:1512:9: error: implicit declaration of function 'sigaction' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        sigaction(SIGALRM, &(const struct sigaction){.sa_handler = &sig_alarm}, NULL);
        ^
terminal.c:1532:21: error: implicit declaration of function 'kill' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                    kill(term->slave, kill_signal);
                    ^
2021-01-21 12:00:02 +01:00
Jan Beich
567a8de3b0
client/server: switch to POSIX header for sockaddr_un
client.c:13:10: fatal error: 'linux/un.h' file not found
 #include <linux/un.h>
          ^~~~~~~~~~~~
client.c:195:24: error: variable has incomplete type 'struct sockaddr_un'
    struct sockaddr_un addr = {.sun_family = AF_UNIX};
                       ^
client.c:195:12: note: forward declaration of 'struct sockaddr_un'
    struct sockaddr_un addr = {.sun_family = AF_UNIX};
           ^
server.c:11:10: fatal error: 'linux/un.h' file not found
 #include <linux/un.h>
          ^~~~~~~~~~~~
server.c:307:24: error: variable has incomplete type 'struct sockaddr_un'
    struct sockaddr_un addr;
                       ^
server.c:307:12: note: forward declaration of 'struct sockaddr_un'
    struct sockaddr_un addr;
           ^
server.c:347:24: error: variable has incomplete type 'struct sockaddr_un'
    struct sockaddr_un addr = {.sun_family = AF_UNIX};
                       ^
server.c:347:12: note: forward declaration of 'struct sockaddr_un'
    struct sockaddr_un addr = {.sun_family = AF_UNIX};
           ^
server.c:394:24: error: variable has incomplete type 'struct sockaddr_un'
    struct sockaddr_un addr = {.sun_family = AF_UNIX};
                       ^
server.c:394:12: note: forward declaration of 'struct sockaddr_un'
    struct sockaddr_un addr = {.sun_family = AF_UNIX};
           ^
2021-01-21 12:00:02 +01:00
Jan Beich
3c379b243b
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-21 12:00:02 +01:00
Daniel Eklöf
c5031be489
Merge branch 'stacktrace' 2021-01-20 17:47:05 +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
22f25a9e4f Print stack trace on assert() failure or when calling fatal_error()
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
2021-01-16 19:56:33 +00:00
Daniel Eklöf
bcf46d9eab
Merge branch 'decset-1047-and-1048' 2021-01-16 15:27:20 +01:00
Daniel Eklöf
0142930702
Merge branch 'dont-crash-when-keyboard-repeat-rate-is-zero' 2021-01-16 15:24:02 +01:00
Daniel Eklöf
e41654d4ea
csi: implement DECSET 47 - use alternate screen buffer 2021-01-16 13:34:40 +01:00
Daniel Eklöf
67ac09ab2e
input: don’t enable keyboard repeat timer when repeat rate is zero
wayland-client-protocol.h:

  Negative values for either rate or delay are illegal. A rate of
  zero will disable any repeating (regardless of the value of
  delay).

This fixes a division-by-zero crash.
2021-01-16 12:33:59 +01:00
Daniel Eklöf
50b309da06
changelog: DECSET 1047+1048: remove ‘Implemented’ 2021-01-15 19:08:51 +01:00
Daniel Eklöf
27fe3faa4c
changelog: DECSET 1047+1048 2021-01-15 19:08:16 +01:00
Daniel Eklöf
cebdae4bae
Merge remote-tracking branch 'origin/draw-sextant-enum-matrix' 2021-01-15 18:43:04 +01:00
Daniel Eklöf
bc053e4879
vt: document correct BS behavior, and why we do differently 2021-01-15 18:40:07 +01:00
Daniel Eklöf
2a012f86d8
term: keep cursor state in grid, for now, but document that it _could_ be moved 2021-01-15 18:02:17 +01:00
Daniel Eklöf
a63e7983dd
csi: add support for ?1047 and ?1048
* 1047 enters/leaves the alt screen, but without saving/restoring the
  cursor.
* 1048 saves/restores the cursor
* 1049 is 1047+1048

Note: when xtsaving and xtrestoring 1048, why simply save/restore the
cursor. Without having read XTerms sources, this appears to be what it
is doing.
2021-01-15 17:09:15 +01:00
Daniel Eklöf
bae3c871bb
term/vt/csi: break out cursor save/restore to dedicated functions 2021-01-15 17:08:30 +01:00
Craig Barnes
dad0549f2e box-drawing: use enum constants in draw_sextant() instead of #define
Both are functionally equivalent here, but the former is also properly
scoped, can be naturally indented and has a less repetitive syntax.
2021-01-15 16:07:51 +00:00
Daniel Eklöf
c0a3f89775
Merge branch 'xsnprintf' 2021-01-15 09:34:24 +01:00
Craig Barnes
3f4cfa338b Add xsnprintf() and remove some unnecessary strlen(3) calls 2021-01-14 21:30:06 +00:00
Daniel Eklöf
b25b8a78a9
Merge branch 'selection-extend-force-character-wise'
Closes #258
2021-01-14 16:30:01 +01:00
Daniel Eklöf
767bd4f1db
config: add ‘select-extend-character-wise’ bind action
This forces the (new) selection mode to be character-wise when
extending a word- or line-wise selection.

Default key binding is ctrl+RMB.
2021-01-14 16:29:29 +01:00
Daniel Eklöf
2e46811953
Merge branch 'sixel-current-geometry-response' 2021-01-14 16:12:49 +01:00
Daniel Eklöf
76db20d977
readme: add IME to the feature list 2021-01-14 15:12:10 +01:00
Daniel Eklöf
5efd34c3c4
sixel: current geometry: don’t exceed current window dimensions
This is similar to what XTerm does, and fixes an issue with lsix,
where the output did not wrap.
2021-01-14 14:41:34 +01:00
Daniel Eklöf
0de0411300
changelog: superceded -> superseded 2021-01-14 10:57:56 +01:00
Daniel Eklöf
5acdc89952
Merge branch 'box-drawing-line-thickness'
Closes #281
2021-01-14 10:49:39 +01:00
Daniel Eklöf
8cd38e0157
Merge branch 'remove-geometry-option'
Closes #287
2021-01-14 10:33:53 +01:00
Craig Barnes
0791fba9c7 main: remove deprecated "--geometry" option
Closes #287
2021-01-13 20:01:05 +00:00
Daniel Eklöf
f54e9dd841
changelog: box drawing line thickness depend on the font size 2021-01-12 17:38:12 +01:00
Daniel Eklöf
4f1b6a8ff3
doc: foot.ini: tweak: document box-drawing-base-thickness 2021-01-12 17:36:20 +01:00
Daniel Eklöf
f178de4c25
config: change default box drawing line thickness from 0.02 -> 0.04 2021-01-12 17:31:55 +01:00
Daniel Eklöf
14ce8fd872
box-drawing: line thickness now depends on both DPI and cell size
Cell size is defined as the length of the diagonal of the cell.
2021-01-12 17:31:55 +01:00
Daniel Eklöf
cbe896f694
config: add temporary(?) tweak option for box drawing line thickness 2021-01-12 17:31:55 +01:00
Daniel Eklöf
f1b4bf1275
box-drawing: LIGHT ARC: ensure row+col are within range 2021-01-12 17:31:55 +01:00
Daniel Eklöf
4bb056bb4b
box-drawing: {h,v}line() + rect(): ensure *end* row/col is >= 0 2021-01-12 17:31:47 +01:00
Daniel Eklöf
c009150ec0
Merge branch 'selection-handle-uri-list-wihtout-final-newline'
Closes #291
2021-01-12 16:15:20 +01:00
Daniel Eklöf
3be80622ef
selection: uri decode: move zero-length check into decode_one_uri() 2021-01-12 14:56:47 +01:00
Daniel Eklöf
497b8e6c0a
changelog: add hyphen between ‘newline’ and ‘terminated’ 2021-01-12 14:55:21 +01:00
Daniel Eklöf
d968bcd506
changelog: pasting non-newline terminated text/uri-list offers 2021-01-12 14:48:20 +01:00
Daniel Eklöf
c8bcce83d5
selection: add a ‘finish’ function, called at the end of receiving clipboard data
This is necessary to decode the final URI in a text/uri-list offer if
it hasn’t been newline terminated.
2021-01-12 14:45:41 +01:00
Daniel Eklöf
e3e3ffc67c
selection: URI decoder: break out decoding of a single URI 2021-01-12 14:45:04 +01:00
Daniel Eklöf
61b7bf91f7
Merge branch 'fix-crash-when-closing-window'
Closes #289
2021-01-12 13:27:09 +01:00
Daniel Eklöf
214371458e
reaper: remove child from list *before* calling the user provided callback
The user provided callback may call reaper_del(), in which case we
will crash when we also try to remove the child from the list.

Remove it from the list before the callback means reaper_del() (if
called by the callback) will just loop through the entire list without
finding the pid and thus do nothing.
2021-01-12 09:30:27 +01:00