From 9e0846ea141fae04ea2e87d81f5f95753871e6de Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Tue, 12 Mar 2024 07:35:42 -0400 Subject: [PATCH 1/3] docs/labwc-config.5: fix "environment directory" typo --- docs/labwc-config.5.scd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 2ba5ce19..ad9c0142 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -47,7 +47,7 @@ an arbitrary order; any variables that must be set in a particular sequence should be set within the same file. Unless the --merge-config option is specified, labwc will consider a particular XDG Base Directory to have provided an environment file if that directory contains either the "environment" -directory or at least one "environment.d/\*.env" file. +file or at least one "environment.d/\*.env" file. Note: environment files are treated differently by Openbox, which will simply source the file as a valid shell script before running the window manager. Files From 1e1e90d0bb9e8e8521fef986fc46317d1e907284 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Tue, 12 Mar 2024 19:53:41 +0000 Subject: [PATCH 2/3] Reload cursor theme and size on reconfigure Fixes: #1587 --- include/input/cursor.h | 1 + src/input/cursor.c | 11 ++++++++++- src/seat.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/input/cursor.h b/include/input/cursor.h index 752d78a8..70905c0f 100644 --- a/include/input/cursor.h +++ b/include/input/cursor.h @@ -119,6 +119,7 @@ void cursor_update_focus(struct server *server); void cursor_update_image(struct seat *seat); void cursor_init(struct seat *seat); +void cursor_load(struct seat *seat); void cursor_emulate_move_absolute(struct seat *seat, struct wlr_input_device *device, double x, double y, uint32_t time_msec); diff --git a/src/input/cursor.c b/src/input/cursor.c index fd7d0e61..b1a661c1 100644 --- a/src/input/cursor.c +++ b/src/input/cursor.c @@ -1253,12 +1253,15 @@ cursor_frame(struct wl_listener *listener, void *data) } void -cursor_init(struct seat *seat) +cursor_load(struct seat *seat) { const char *xcursor_theme = getenv("XCURSOR_THEME"); const char *xcursor_size = getenv("XCURSOR_SIZE"); uint32_t size = xcursor_size ? atoi(xcursor_size) : 24; + if (seat->xcursor_manager) { + wlr_xcursor_manager_destroy(seat->xcursor_manager); + } seat->xcursor_manager = wlr_xcursor_manager_create(xcursor_theme, size); wlr_xcursor_manager_load(seat->xcursor_manager, 1); @@ -1293,6 +1296,12 @@ cursor_init(struct seat *seat) "Cursor theme is missing cursor names, using fallback"); cursor_names = cursors_x11; } +} + +void +cursor_init(struct seat *seat) +{ + cursor_load(seat); /* Set the initial cursor image so the cursor is visible right away */ cursor_set(seat, LAB_CURSOR_DEFAULT); diff --git a/src/seat.c b/src/seat.c index 1d4a20e7..4ef175d9 100644 --- a/src/seat.c +++ b/src/seat.c @@ -529,6 +529,7 @@ seat_init(struct server *server) seat->input_method_relay = input_method_relay_create(seat); + seat->xcursor_manager = NULL; seat->cursor = wlr_cursor_create(); if (!seat->cursor) { wlr_log(WLR_ERROR, "unable to create cursor"); @@ -571,6 +572,7 @@ seat_reconfigure(struct server *server) { struct seat *seat = &server->seat; struct input *input; + cursor_load(seat); wl_list_for_each(input, &seat->inputs, link) { switch (input->wlr_input_device->type) { case WLR_INPUT_DEVICE_KEYBOARD: From 5cb3583108aad5f6084e035158cec940a3845b98 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Mon, 11 Mar 2024 22:04:52 +0000 Subject: [PATCH 3/3] keyboard: use 'us' as fallback for XKB_DEFAULT_LAYOUT ...if keymap cannot be created for the provided XKB_DEFAULT_LAYOUT. If keymap still cannot be created, exit with a helpful message to avoid crash that is hard to understand. Fixes: https://github.com/stefonarch/lxqt-labwc-session/issues/7 --- src/input/keyboard.c | 13 ++++++++++++- src/seat.c | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/input/keyboard.c b/src/input/keyboard.c index 4a68428b..0ca6d390 100644 --- a/src/input/keyboard.c +++ b/src/input/keyboard.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only +#define _POSIX_C_SOURCE 200809L #include +#include #include #include #include @@ -628,6 +630,8 @@ reset_window_keyboard_layout_groups(struct server *server) static void set_layout(struct server *server, struct wlr_keyboard *kb) { + static bool fallback_mode; + struct xkb_rule_names rules = { 0 }; struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules, @@ -639,7 +643,14 @@ set_layout(struct server *server, struct wlr_keyboard *kb) } xkb_keymap_unref(keymap); } else { - wlr_log(WLR_ERROR, "Failed to create xkb keymap"); + wlr_log(WLR_ERROR, "failed to create xkb keymap for layout '%s'", + getenv("XKB_DEFAULT_LAYOUT")); + if (!fallback_mode) { + wlr_log(WLR_ERROR, "entering fallback mode with layout 'us'"); + fallback_mode = true; + setenv("XKB_DEFAULT_LAYOUT", "us", 1); + set_layout(server, kb); + } } xkb_context_unref(context); } diff --git a/src/seat.c b/src/seat.c index 4ef175d9..53861edc 100644 --- a/src/seat.c +++ b/src/seat.c @@ -296,6 +296,11 @@ new_keyboard(struct seat *seat, struct wlr_input_device *device, bool virtual) keyboard->wlr_keyboard = kb; keyboard->is_virtual = virtual; + if (!seat->keyboard_group->keyboard.keymap) { + wlr_log(WLR_ERROR, "cannot set keymap"); + exit(EXIT_FAILURE); + } + wlr_keyboard_set_keymap(kb, seat->keyboard_group->keyboard.keymap); /*