mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
commit
a6b66b73b1
18 changed files with 100 additions and 40 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
image: freebsd/latest
|
image: freebsd/latest
|
||||||
packages:
|
packages:
|
||||||
|
- evdev-proto
|
||||||
|
- libepoll-shim
|
||||||
- meson
|
- meson
|
||||||
- ninja
|
- ninja
|
||||||
- pkgconf
|
- pkgconf
|
||||||
|
|
@ -11,10 +13,9 @@ packages:
|
||||||
- harfbuzz
|
- harfbuzz
|
||||||
- pixman
|
- pixman
|
||||||
- libxkbcommon
|
- libxkbcommon
|
||||||
- ncurses
|
|
||||||
- check
|
- check
|
||||||
- ttf-hack
|
- hack-font
|
||||||
- font-noto-emoji
|
- noto-emoji
|
||||||
|
|
||||||
sources:
|
sources:
|
||||||
- https://codeberg.org/dnkl/foot
|
- https://codeberg.org/dnkl/foot
|
||||||
|
|
@ -24,14 +25,16 @@ sources:
|
||||||
# condition: failure
|
# condition: failure
|
||||||
# to: <committer>
|
# to: <committer>
|
||||||
|
|
||||||
|
# TODO: drop -Dc_args=-Wno-missing-braces when freebsd/latest is >= 13
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- debug: |
|
- debug: |
|
||||||
mkdir -p bld/debug
|
mkdir -p bld/debug
|
||||||
meson --buildtype=debug -Dfcft:text-shaping=enabled -Dfcft:test-text-shaping=true foot bld/debug
|
meson --buildtype=debug -Dc_args=-Wno-missing-braces -Dterminfo=false -Dfcft:text-shaping=enabled -Dfcft:test-text-shaping=true foot bld/debug
|
||||||
ninja -C bld/debug -k0
|
ninja -C bld/debug -k0
|
||||||
meson test -C bld/debug --print-errorlogs
|
meson test -C bld/debug --print-errorlogs
|
||||||
- release: |
|
- release: |
|
||||||
mkdir -p bld/release
|
mkdir -p bld/release
|
||||||
meson --buildtype=minsize -Dfcft:text-shaping=enabled -Dfcft:test-text-shaping=true foot bld/release
|
meson --buildtype=minsize -Dc_args=-Wno-missing-braces -Dterminfo=false -Dfcft:text-shaping=enabled -Dfcft:test-text-shaping=true foot bld/release
|
||||||
ninja -C bld/release -k0
|
ninja -C bld/release -k0
|
||||||
meson test -C bld/release --print-errorlogs
|
meson test -C bld/release --print-errorlogs
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
* Key/mouse binding `select-extend-character-wise`, which forces the
|
* Key/mouse binding `select-extend-character-wise`, which forces the
|
||||||
selection mode to 'character-wise' when extending a selection.
|
selection mode to 'character-wise' when extending a selection.
|
||||||
* `DECSET` `47`, `1047` and `1048`.
|
* `DECSET` `47`, `1047` and `1048`.
|
||||||
|
* FreeBSD support
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
@ -91,6 +92,7 @@
|
||||||
* [birger](https://codeberg.org/birger)
|
* [birger](https://codeberg.org/birger)
|
||||||
* [pc](https://codeberg.org/pc)
|
* [pc](https://codeberg.org/pc)
|
||||||
* [FollieHiyuki](https://codeberg.org/FollieHiyuki)
|
* [FollieHiyuki](https://codeberg.org/FollieHiyuki)
|
||||||
|
* jbeich
|
||||||
|
|
||||||
|
|
||||||
## 1.6.2
|
## 1.6.2
|
||||||
|
|
|
||||||
4
client.c
4
client.c
|
|
@ -9,7 +9,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <linux/un.h>
|
#include <sys/un.h>
|
||||||
|
|
||||||
#define LOG_MODULE "foot-client"
|
#define LOG_MODULE "foot-client"
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
|
|
@ -263,7 +263,7 @@ main(int argc, char *const *argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Total packet length, not (yet) including argv[] */
|
/* Total packet length, not (yet) including argv[] */
|
||||||
size_t total_len = (
|
uint64_t total_len = (
|
||||||
sizeof(data) +
|
sizeof(data) +
|
||||||
cwd_len +
|
cwd_len +
|
||||||
term_len +
|
term_len +
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,6 @@ case ${state} in
|
||||||
;;
|
;;
|
||||||
|
|
||||||
terms)
|
terms)
|
||||||
_values 'terminal definitions' $(find /usr/share/terminfo -type f -printf "%f\n")
|
_values 'terminal definitions' /usr/share/terminfo/**/*(.:t)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,6 @@ _arguments \
|
||||||
|
|
||||||
case ${state} in
|
case ${state} in
|
||||||
terms)
|
terms)
|
||||||
_values 'terminal definitions' $(find /usr/share/terminfo -type f -printf "%f\n")
|
_values 'terminal definitions' /usr/share/terminfo/**/*(.:t)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
4
config.c
4
config.c
|
|
@ -2042,7 +2042,11 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
*conf = (struct config) {
|
*conf = (struct config) {
|
||||||
|
#ifdef HAVE_TERMINFO
|
||||||
.term = xstrdup("foot"),
|
.term = xstrdup("foot"),
|
||||||
|
#else
|
||||||
|
.term = xstrdup("xterm-256color"),
|
||||||
|
#endif
|
||||||
.shell = get_shell(),
|
.shell = get_shell(),
|
||||||
.title = xstrdup("foot"),
|
.title = xstrdup("foot"),
|
||||||
.app_id = xstrdup("foot"),
|
.app_id = xstrdup("foot"),
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ in this order:
|
||||||
by prepending a '-' to argv[0]. Default: _no_.
|
by prepending a '-' to argv[0]. Default: _no_.
|
||||||
|
|
||||||
*term*
|
*term*
|
||||||
Value to set the environment variable *TERM* to. Default: _foot_.
|
Value to set the environment variable *TERM* to. Default: _foot_
|
||||||
|
or _xterm-256color_ if built with _-Dterminfo=false_
|
||||||
|
|
||||||
*font*, *font-bold*, *font-italic*, *font-bold-italic*
|
*font*, *font-bold*, *font-italic*, *font-bold-italic*
|
||||||
Comma separated list of fonts to use, in fontconfig format. That
|
Comma separated list of fonts to use, in fontconfig format. That
|
||||||
|
|
|
||||||
2
foot.ini
2
foot.ini
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- conf -*-
|
# -*- conf -*-
|
||||||
|
|
||||||
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
|
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
|
||||||
# term=foot
|
# term=foot (or xterm-256color if built with -Dterminfo=false)
|
||||||
# login-shell=no
|
# login-shell=no
|
||||||
|
|
||||||
# font=monospace:size=8
|
# font=monospace:size=8
|
||||||
|
|
|
||||||
2
main.c
2
main.c
|
|
@ -10,7 +10,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
|
|
||||||
39
meson.build
39
meson.build
|
|
@ -12,8 +12,12 @@ is_debug_build = get_option('buildtype').startswith('debug')
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
|
if cc.has_function('memfd_create')
|
||||||
|
add_project_arguments('-DMEMFD_CREATE', language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
['-D_POSIX_C_SOURCE=200809L', '-D_GNU_SOURCE=200809L'] +
|
['-D_GNU_SOURCE=200809L'] +
|
||||||
(is_debug_build
|
(is_debug_build
|
||||||
? ['-D_DEBUG']
|
? ['-D_DEBUG']
|
||||||
: [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) +
|
: [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]) +
|
||||||
|
|
@ -56,7 +60,8 @@ if cc.has_argument('-fmacro-prefix-map=/foo=')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
math = cc.find_library('m')
|
math = cc.find_library('m')
|
||||||
threads = dependency('threads')
|
threads = [dependency('threads'), cc.find_library('stdthreads', required: false)]
|
||||||
|
libepoll = dependency('epoll-shim', required: false)
|
||||||
pixman = dependency('pixman-1')
|
pixman = dependency('pixman-1')
|
||||||
wayland_protocols = dependency('wayland-protocols')
|
wayland_protocols = dependency('wayland-protocols')
|
||||||
wayland_client = dependency('wayland-client')
|
wayland_client = dependency('wayland-client')
|
||||||
|
|
@ -67,6 +72,11 @@ fontconfig = dependency('fontconfig')
|
||||||
tllist = dependency('tllist', version: '>=1.0.4', fallback: 'tllist')
|
tllist = dependency('tllist', version: '>=1.0.4', fallback: 'tllist')
|
||||||
fcft = dependency('fcft', version: ['>=2.3.0', '<3.0.0'], fallback: 'fcft')
|
fcft = dependency('fcft', version: ['>=2.3.0', '<3.0.0'], fallback: 'fcft')
|
||||||
|
|
||||||
|
tic = find_program('tic', native: true, required: get_option('terminfo'))
|
||||||
|
if tic.found()
|
||||||
|
add_project_arguments('-DHAVE_TERMINFO', language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
wayland_protocols_datadir = wayland_protocols.get_pkgconfig_variable('pkgdatadir')
|
||||||
|
|
||||||
wscanner = dependency('wayland-scanner', native: true)
|
wscanner = dependency('wayland-scanner', native: true)
|
||||||
|
|
@ -126,7 +136,7 @@ vtlib = static_library(
|
||||||
'vt.c', 'vt.h',
|
'vt.c', 'vt.h',
|
||||||
wl_proto_src + wl_proto_headers,
|
wl_proto_src + wl_proto_headers,
|
||||||
version,
|
version,
|
||||||
dependencies: [pixman, fcft, tllist],
|
dependencies: [libepoll, pixman, fcft, tllist, wayland_client],
|
||||||
link_with: misc,
|
link_with: misc,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -136,7 +146,7 @@ pgolib = static_library(
|
||||||
'selection.c', 'selection.h',
|
'selection.c', 'selection.h',
|
||||||
'terminal.c', 'terminal.h',
|
'terminal.c', 'terminal.h',
|
||||||
wl_proto_src + wl_proto_headers,
|
wl_proto_src + wl_proto_headers,
|
||||||
dependencies: [pixman, fcft, tllist],
|
dependencies: [libepoll, pixman, fcft, tllist, wayland_client],
|
||||||
link_with: vtlib,
|
link_with: vtlib,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -144,7 +154,7 @@ executable(
|
||||||
'pgo',
|
'pgo',
|
||||||
'pgo/pgo.c',
|
'pgo/pgo.c',
|
||||||
wl_proto_src + wl_proto_headers,
|
wl_proto_src + wl_proto_headers,
|
||||||
dependencies: [math, threads, pixman, wayland_client, fcft, tllist],
|
dependencies: [math, threads, libepoll, pixman, wayland_client, fcft, tllist],
|
||||||
link_with: pgolib,
|
link_with: pgolib,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -173,7 +183,7 @@ executable(
|
||||||
'user-notification.h',
|
'user-notification.h',
|
||||||
'wayland.c', 'wayland.h',
|
'wayland.c', 'wayland.h',
|
||||||
wl_proto_src + wl_proto_headers, version,
|
wl_proto_src + wl_proto_headers, version,
|
||||||
dependencies: [math, threads, pixman, wayland_client, wayland_cursor, xkb, fontconfig,
|
dependencies: [math, threads, libepoll, pixman, wayland_client, wayland_cursor, xkb, fontconfig,
|
||||||
tllist, fcft],
|
tllist, fcft],
|
||||||
link_with: pgolib,
|
link_with: pgolib,
|
||||||
install: true)
|
install: true)
|
||||||
|
|
@ -189,14 +199,15 @@ executable(
|
||||||
version,
|
version,
|
||||||
install: true)
|
install: true)
|
||||||
|
|
||||||
tic = find_program('tic', native: true)
|
if tic.found()
|
||||||
custom_target(
|
custom_target(
|
||||||
'terminfo',
|
'terminfo',
|
||||||
output: 'f',
|
output: 'f',
|
||||||
input: 'foot.info',
|
input: 'foot.info',
|
||||||
command: [tic, '-x', '-o', '@OUTDIR@', '-e', 'foot,foot-direct', '@INPUT@'],
|
command: [tic, '-x', '-o', '@OUTDIR@', '-e', 'foot,foot-direct', '@INPUT@'],
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: join_paths(get_option('datadir'), 'terminfo'))
|
install_dir: join_paths(get_option('datadir'), 'terminfo'))
|
||||||
|
endif
|
||||||
|
|
||||||
install_data(
|
install_data(
|
||||||
'LICENSE', 'README.md', 'CHANGELOG.md',
|
'LICENSE', 'README.md', 'CHANGELOG.md',
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
option('ime', type: 'boolean', value: true, description: 'IME (Input Method Editor) support')
|
option('ime', type: 'boolean', value: true, description: 'IME (Input Method Editor) support')
|
||||||
|
option('terminfo', type: 'boolean', value: true, description: 'Install terminfo')
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,16 @@ main(int argc, const char *const *argv)
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
|
#if defined(MEMFD_CREATE)
|
||||||
int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
|
int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
// memfd_create on FreeBSD 13 is SHM_ANON without sealing support
|
||||||
|
int mem_fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);
|
||||||
|
#else
|
||||||
|
char name[] = "/tmp/foot-pgo-ptmx-XXXXXX";
|
||||||
|
int mem_fd = mkostemp(name, O_CLOEXEC);
|
||||||
|
unlink(name);
|
||||||
|
#endif
|
||||||
if (mem_fd < 0) {
|
if (mem_fd < 0) {
|
||||||
fprintf(stderr, "error: failed to create memory FD\n");
|
fprintf(stderr, "error: failed to create memory FD\n");
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
10
render.c
10
render.c
|
|
@ -5,7 +5,13 @@
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <sys/prctl.h>
|
#include <pthread.h>
|
||||||
|
#if __has_include(<pthread_np.h>)
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#define pthread_setname_np(thread, name) (pthread_set_name_np(thread, name), 0)
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
#define pthread_setname_np(thread, name) pthread_setname_np(thread, "%s", (void *)name)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <wayland-cursor.h>
|
#include <wayland-cursor.h>
|
||||||
#include <xdg-shell.h>
|
#include <xdg-shell.h>
|
||||||
|
|
@ -1231,7 +1237,7 @@ render_worker_thread(void *_ctx)
|
||||||
char proc_title[16];
|
char proc_title[16];
|
||||||
snprintf(proc_title, sizeof(proc_title), "foot:render:%d", my_id);
|
snprintf(proc_title, sizeof(proc_title), "foot:render:%d", my_id);
|
||||||
|
|
||||||
if (prctl(PR_SET_NAME, proc_title, 0, 0, 0) < 0)
|
if (pthread_setname_np(pthread_self(), proc_title) < 0)
|
||||||
LOG_ERRNO("render worker %d: failed to set process title", my_id);
|
LOG_ERRNO("render worker %d: failed to set process title", my_id);
|
||||||
|
|
||||||
sem_t *start = &term->render.workers.start;
|
sem_t *start = &term->render.workers.start;
|
||||||
|
|
|
||||||
2
server.c
2
server.c
|
|
@ -8,7 +8,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
|
||||||
#include <linux/un.h>
|
#include <sys/un.h>
|
||||||
|
|
||||||
#include <tllist.h>
|
#include <tllist.h>
|
||||||
|
|
||||||
|
|
|
||||||
38
shm.c
38
shm.c
|
|
@ -9,8 +9,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <linux/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <linux/memfd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <pixman.h>
|
#include <pixman.h>
|
||||||
|
|
@ -130,6 +129,7 @@ static const struct wl_buffer_listener buffer_listener = {
|
||||||
.release = &buffer_release,
|
.release = &buffer_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if __SIZEOF_POINTER__ == 8
|
||||||
static size_t
|
static size_t
|
||||||
page_size(void)
|
page_size(void)
|
||||||
{
|
{
|
||||||
|
|
@ -146,6 +146,7 @@ page_size(void)
|
||||||
xassert(size > 0);
|
xassert(size > 0);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
instantiate_offset(struct wl_shm *shm, struct buffer *buf, off_t new_offset)
|
instantiate_offset(struct wl_shm *shm, struct buffer *buf, off_t new_offset)
|
||||||
|
|
@ -274,18 +275,27 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
|
||||||
LOG_DBG("cookie=%lx: allocating new buffer: %zu KB", cookie, size / 1024);
|
LOG_DBG("cookie=%lx: allocating new buffer: %zu KB", cookie, size / 1024);
|
||||||
|
|
||||||
/* Backing memory for SHM */
|
/* Backing memory for SHM */
|
||||||
|
#if defined(MEMFD_CREATE)
|
||||||
pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
|
pool_fd = memfd_create("foot-wayland-shm-buffer-pool", MFD_CLOEXEC | MFD_ALLOW_SEALING);
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
// memfd_create on FreeBSD 13 is SHM_ANON without sealing support
|
||||||
|
pool_fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);
|
||||||
|
#else
|
||||||
|
char name[] = "/tmp/foot-wayland-shm-buffer-pool-XXXXXX";
|
||||||
|
pool_fd = mkostemp(name, O_CLOEXEC);
|
||||||
|
unlink(name);
|
||||||
|
#endif
|
||||||
if (pool_fd == -1) {
|
if (pool_fd == -1) {
|
||||||
LOG_ERRNO("failed to create SHM backing memory file");
|
LOG_ERRNO("failed to create SHM backing memory file");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if __SIZEOF_POINTER__ == 8
|
||||||
off_t initial_offset = 0;
|
|
||||||
off_t memfd_size = size;
|
|
||||||
#else
|
|
||||||
off_t initial_offset = scrollable && max_pool_size > 0 ? (max_pool_size / 4) & ~(page_size() - 1) : 0;
|
off_t initial_offset = scrollable && max_pool_size > 0 ? (max_pool_size / 4) & ~(page_size() - 1) : 0;
|
||||||
off_t memfd_size = scrollable && max_pool_size > 0 ? max_pool_size : size;
|
off_t memfd_size = scrollable && max_pool_size > 0 ? max_pool_size : size;
|
||||||
|
#else
|
||||||
|
off_t initial_offset = 0;
|
||||||
|
off_t memfd_size = size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG_DBG("memfd-size: %lu, initial offset: %lu", memfd_size, initial_offset);
|
LOG_DBG("memfd-size: %lu, initial offset: %lu", memfd_size, initial_offset);
|
||||||
|
|
@ -297,7 +307,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
|
||||||
|
|
||||||
if (!can_punch_hole_initialized) {
|
if (!can_punch_hole_initialized) {
|
||||||
can_punch_hole_initialized = true;
|
can_punch_hole_initialized = true;
|
||||||
#if defined(__x86_64__)
|
#if __SIZEOF_POINTER__ == 8 && defined(FALLOC_FL_PUNCH_HOLE)
|
||||||
can_punch_hole = fallocate(
|
can_punch_hole = fallocate(
|
||||||
pool_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1) == 0;
|
pool_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1) == 0;
|
||||||
|
|
||||||
|
|
@ -333,6 +343,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MEMFD_CREATE)
|
||||||
/* Seal file - we no longer allow any kind of resizing */
|
/* Seal file - we no longer allow any kind of resizing */
|
||||||
/* TODO: wayland mmaps(PROT_WRITE), for some unknown reason, hence we cannot use F_SEAL_FUTURE_WRITE */
|
/* TODO: wayland mmaps(PROT_WRITE), for some unknown reason, hence we cannot use F_SEAL_FUTURE_WRITE */
|
||||||
if (fcntl(pool_fd, F_ADD_SEALS,
|
if (fcntl(pool_fd, F_ADD_SEALS,
|
||||||
|
|
@ -341,6 +352,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
|
||||||
LOG_ERRNO("failed to seal SHM backing memory file");
|
LOG_ERRNO("failed to seal SHM backing memory file");
|
||||||
/* This is not a fatal error */
|
/* This is not a fatal error */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
pool = wl_shm_create_pool(shm, pool_fd, memfd_size);
|
pool = wl_shm_create_pool(shm, pool_fd, memfd_size);
|
||||||
if (pool == NULL) {
|
if (pool == NULL) {
|
||||||
|
|
@ -400,14 +412,15 @@ err:
|
||||||
bool
|
bool
|
||||||
shm_can_scroll(const struct buffer *buf)
|
shm_can_scroll(const struct buffer *buf)
|
||||||
{
|
{
|
||||||
#if defined(__i386__)
|
#if __SIZEOF_POINTER__ == 8
|
||||||
|
return can_punch_hole && max_pool_size > 0 && buf->scrollable;
|
||||||
|
#else
|
||||||
/* Not enough virtual address space in 32-bit */
|
/* Not enough virtual address space in 32-bit */
|
||||||
return false;
|
return false;
|
||||||
#else
|
|
||||||
return can_punch_hole && max_pool_size > 0 && buf->scrollable;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __SIZEOF_POINTER__ == 8 && defined(FALLOC_FL_PUNCH_HOLE)
|
||||||
static bool
|
static bool
|
||||||
wrap_buffer(struct wl_shm *shm, struct buffer *buf, off_t new_offset)
|
wrap_buffer(struct wl_shm *shm, struct buffer *buf, off_t new_offset)
|
||||||
{
|
{
|
||||||
|
|
@ -640,12 +653,14 @@ err:
|
||||||
abort();
|
abort();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif /* FALLOC_FL_PUNCH_HOLE */
|
||||||
|
|
||||||
bool
|
bool
|
||||||
shm_scroll(struct wl_shm *shm, struct buffer *buf, int rows,
|
shm_scroll(struct wl_shm *shm, struct buffer *buf, int rows,
|
||||||
int top_margin, int top_keep_rows,
|
int top_margin, int top_keep_rows,
|
||||||
int bottom_margin, int bottom_keep_rows)
|
int bottom_margin, int bottom_keep_rows)
|
||||||
{
|
{
|
||||||
|
#if __SIZEOF_POINTER__ == 8 && defined(FALLOC_FL_PUNCH_HOLE)
|
||||||
if (!shm_can_scroll(buf))
|
if (!shm_can_scroll(buf))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -653,6 +668,9 @@ shm_scroll(struct wl_shm *shm, struct buffer *buf, int rows,
|
||||||
return rows > 0
|
return rows > 0
|
||||||
? shm_scroll_forward(shm, buf, rows, top_margin, top_keep_rows, bottom_margin, bottom_keep_rows)
|
? shm_scroll_forward(shm, buf, rows, top_margin, top_keep_rows, bottom_margin, bottom_keep_rows)
|
||||||
: shm_scroll_reverse(shm, buf, -rows, top_margin, top_keep_rows, bottom_margin, bottom_keep_rows);
|
: shm_scroll_reverse(shm, buf, -rows, top_margin, top_keep_rows, bottom_margin, bottom_keep_rows);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
2
slave.c
2
slave.c
|
|
@ -178,6 +178,7 @@ slave_exec(int ptmx, char *argv[], int err_fd, bool login_shell,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef IUTF8
|
||||||
{
|
{
|
||||||
struct termios flags;
|
struct termios flags;
|
||||||
if (tcgetattr(pts, &flags) < 0) {
|
if (tcgetattr(pts, &flags) < 0) {
|
||||||
|
|
@ -191,6 +192,7 @@ slave_exec(int ptmx, char *argv[], int err_fd, bool login_shell,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (tll_length(*notifications) > 0) {
|
if (tll_length(*notifications) > 0) {
|
||||||
int flags = fcntl(pts, F_GETFL);
|
int flags = fcntl(pts, F_GETFL);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
|
||||||
|
#if defined(__GLIBC__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
||||||
2
uri.c
2
uri.c
|
|
@ -266,7 +266,7 @@ err:
|
||||||
bool
|
bool
|
||||||
hostname_is_localhost(const char *hostname)
|
hostname_is_localhost(const char *hostname)
|
||||||
{
|
{
|
||||||
char this_host[HOST_NAME_MAX];
|
char this_host[_POSIX_HOST_NAME_MAX];
|
||||||
if (gethostname(this_host, sizeof(this_host)) < 0)
|
if (gethostname(this_host, sizeof(this_host)) < 0)
|
||||||
this_host[0] = '\0';
|
this_host[0] = '\0';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue