From 39571a32c61844281b5476ead706e125266c584d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 9 Mar 2020 21:11:41 +0100 Subject: [PATCH 01/11] changelog: update --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e52a01f..f2bb0783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,13 @@ ## Unreleased ### Added + ### Changed +* Changed icon name in `foot.desktop` and `foot-server.desktop` from + _terminal_ to _utilities-terminal_. +* `XDG_SESSION_ID` is now included in the server/daemon default socket + path. + ### Deprecated ### Removed ### Fixed From 1581143b0bc2a8d2b74f2330c5201ecda3237d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:00:39 +0100 Subject: [PATCH 02/11] shm: log errno error message too --- shm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shm.c b/shm.c index 56395fab..71f964a8 100644 --- a/shm.c +++ b/shm.c @@ -144,7 +144,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) mmapped = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, pool_fd, 0); if (mmapped == MAP_FAILED) { - LOG_ERR("failed to mmap SHM backing memory file"); + LOG_ERRNO("failed to mmap SHM backing memory file"); goto err; } From 7efe2c6c973ee40e77c07402b6bf28e4d2d11384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:01:01 +0100 Subject: [PATCH 03/11] shm: try to mmap with MAP_UNINITIALIZED This flag is expected to be ignored on most systems, but can't hurt to try. --- shm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shm.c b/shm.c index 71f964a8..ba88b361 100644 --- a/shm.c +++ b/shm.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -142,7 +143,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) } } - mmapped = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, pool_fd, 0); + mmapped = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_UNINITIALIZED, pool_fd, 0); if (mmapped == MAP_FAILED) { LOG_ERRNO("failed to mmap SHM backing memory file"); goto err; From 867dc836abb8904f324f5904d8714012fab33bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:01:30 +0100 Subject: [PATCH 04/11] shm: set pool_fd=1 after closing it, to avoid double-closing on error --- shm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shm.c b/shm.c index ba88b361..95b7ac78 100644 --- a/shm.c +++ b/shm.c @@ -164,7 +164,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) /* We use the entire pool for our single buffer */ wl_shm_pool_destroy(pool); pool = NULL; - close(pool_fd); + close(pool_fd); pool_fd = -1; /* One pixman image for each worker thread (do we really need multiple?) */ pix = pixman_image_create_bits_no_clear( From cf5da1039ffb53a9ae1d789a78835b9573a95d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:01:56 +0100 Subject: [PATCH 05/11] shm: mmap returns MAP_FAILED, so use that as guard value --- shm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shm.c b/shm.c index 95b7ac78..54015798 100644 --- a/shm.c +++ b/shm.c @@ -105,7 +105,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) */ int pool_fd = -1; - void *mmapped = NULL; + void *mmapped = MAP_FAILED; size_t size = 0; struct wl_shm_pool *pool = NULL; @@ -199,7 +199,7 @@ err: wl_shm_pool_destroy(pool); if (pool_fd != -1) close(pool_fd); - if (mmapped != NULL) + if (mmapped != MAP_FAILED) munmap(mmapped, size); return NULL; From 8a6cfb738b8c21b79d8f6497f8147e0085e26c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:02:10 +0100 Subject: [PATCH 06/11] shm: we don't really handle SHM failures, so just abort() --- shm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shm.c b/shm.c index 54015798..a33b4334 100644 --- a/shm.c +++ b/shm.c @@ -202,6 +202,8 @@ err: if (mmapped != MAP_FAILED) munmap(mmapped, size); + /* We don't handle this */ + abort(); return NULL; } From 270604b318bd573b9acf396bebf7fcf1fdf5e893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:02:24 +0100 Subject: [PATCH 07/11] wayland: remove empty line --- wayland.c | 1 - 1 file changed, 1 deletion(-) diff --git a/wayland.c b/wayland.c index 0baafa28..322188ae 100644 --- a/wayland.c +++ b/wayland.c @@ -279,7 +279,6 @@ static const struct wp_presentation_listener presentation_listener = { .clock_id = &clock_id, }; - static bool verify_iface_version(const char *iface, uint32_t version, uint32_t wanted) { From 1c42fadcf7f77903093cb4818bf0e28ebceb64b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:02:37 +0100 Subject: [PATCH 08/11] client: update --server-socket usage to mention XDG_SESSION_ID --- client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.c b/client.c index 30271c86..daa0e252 100644 --- a/client.c +++ b/client.c @@ -34,7 +34,7 @@ print_usage(const char *prog_name) printf("Options:\n"); printf(" -t,--term=TERM value to set the environment variable TERM to (foot)\n" " --login-shell start shell as a login shell\n" - " -s,--server-socket=PATH path to the server UNIX domain socket (default=XDG_RUNTIME_DIR/foot.sock)\n" + " -s,--server-socket=PATH path to the server UNIX domain socket (default=$XDG_RUNTIME_DIR/foot-$XDG_SESSION_ID.sock)\n" " -l,--log-colorize=[never|always|auto] enable/disable colorization of log output on stderr\n" " -v,--version show the version number and quit\n"); } From 9049488acc36db90719357ee5327435baf617f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:02:57 +0100 Subject: [PATCH 09/11] client: log path we actually tried to connect to (and failed) --- client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.c b/client.c index daa0e252..faa7c919 100644 --- a/client.c +++ b/client.c @@ -145,7 +145,7 @@ main(int argc, char *const *argv) if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) == 0) connected = true; else - LOG_WARN("%s/foot.sock: failed to connect, will now try /tmp/foot.sock", xdg_runtime); + LOG_WARN("%s: failed to connect, will now try /tmp/foot.sock", addr.sun_path); } if (!connected) { From aa1aa0c09df44c286a12d7663decfc95988bc9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:07:12 +0100 Subject: [PATCH 10/11] terminal: appky scale factor when force-resizing on font reload If we don't, we'll end up e.g. increasing the window size when moving the window between outputs with different scaling. Closes #3 --- terminal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal.c b/terminal.c index 0a7e5b5e..2a742268 100644 --- a/terminal.c +++ b/terminal.c @@ -525,7 +525,7 @@ term_set_fonts(struct terminal *term, struct font *fonts[static 4]) term->fonts[0]->ascent + term->fonts[0]->descent); LOG_INFO("cell width=%d, height=%d", term->cell_width, term->cell_height); - render_resize_force(term, term->width, term->height); + render_resize_force(term, term->width / term->scale, term->height / term->scale); return true; } From 57fe26955fd7fe13ffc2d2c49b0417d1404a6cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:17:14 +0100 Subject: [PATCH 11/11] changelog: updated to mention fix for #3 I really need to learn to update the changelog **with** the fix... --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2bb0783..642dc0c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,11 @@ ### Deprecated ### Removed + ### Fixed +* Window size doubling when moving window between outputs with + different scaling factors (https://codeberg.org/dnkl/foot/issues/3). + ### Security ## 1.2.1