Merge branch 'master' into master

This commit is contained in:
Manu Linares 2026-04-02 16:31:28 -03:00 committed by GitHub
commit 8e492ff895
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 250 additions and 93 deletions

View file

@ -1355,6 +1355,12 @@ entry(xmlNode *node, char *nodename, char *content)
} else if (!strcasecmp(nodename, "relativeMotionSensitivity.tabletTool")) {
rc.tablet_tool.relative_motion_sensitivity =
tablet_get_dbl_if_positive(content, "relativeMotionSensitivity");
} else if (!strcasecmp(nodename, "minPressure.tabletTool")) {
rc.tablet_tool.min_pressure =
tablet_get_dbl_if_positive(content, "minPressure");
} else if (!strcasecmp(nodename, "maxPressure.tabletTool")) {
rc.tablet_tool.max_pressure =
tablet_get_dbl_if_positive(content, "maxPressure");
} else if (!strcasecmp(nodename, "ignoreButtonReleasePeriod.menu")) {
rc.menu_ignore_button_release_period = atoi(content);
} else if (!strcasecmp(nodename, "showIcons.menu")) {
@ -1475,6 +1481,8 @@ rcxml_init(void)
tablet_load_default_button_mappings();
rc.tablet_tool.motion = LAB_MOTION_ABSOLUTE;
rc.tablet_tool.relative_motion_sensitivity = 1.0;
rc.tablet_tool.min_pressure = 0.0;
rc.tablet_tool.max_pressure = 1.0;
rc.repeat_rate = 25;
rc.repeat_delay = 600;

View file

@ -8,8 +8,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <wlr/backend/drm.h>
#include <wlr/backend/multi.h>
#include <wlr/config.h>
#include <wlr/util/log.h>
#include "common/buf.h"
#include "common/dir.h"
@ -20,6 +20,12 @@
#include "config/rcxml.h"
#include "labwc.h"
#if WLR_HAS_DRM_BACKEND
#include <wlr/backend/drm.h>
#else
#define wlr_backend_is_drm(backend) (false)
#endif
static const char *const env_vars[] = {
"WAYLAND_DISPLAY",
"XDG_CURRENT_DESKTOP",

View file

@ -3,7 +3,7 @@
#include "input/cursor.h"
#include <assert.h>
#include <time.h>
#include <wlr/backend/libinput.h>
#include <wlr/config.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_cursor_shape_v1.h>
#include <wlr/types/wlr_data_device.h>
@ -38,6 +38,10 @@
#include "view.h"
#include "xwayland.h"
#if WLR_HAS_LIBINPUT_BACKEND
#include <wlr/backend/libinput.h>
#endif
#define LAB_CURSOR_SHAPE_V1_VERSION 1
struct constraint {
@ -898,6 +902,7 @@ preprocess_cursor_motion(struct seat *seat, struct wlr_pointer *pointer,
static double get_natural_scroll_factor(struct wlr_input_device *wlr_input_device)
{
#if WLR_HAS_LIBINPUT_BACKEND
if (wlr_input_device_is_libinput(wlr_input_device)) {
struct libinput_device *libinput_device =
wlr_libinput_get_device_handle(wlr_input_device);
@ -905,7 +910,7 @@ static double get_natural_scroll_factor(struct wlr_input_device *wlr_input_devic
return -1.0;
}
}
#endif
return 1.0;
}

View file

@ -3,7 +3,7 @@
#include "input/keyboard.h"
#include <assert.h>
#include <stdlib.h>
#include <wlr/backend/session.h>
#include <wlr/config.h>
#include <wlr/interfaces/wlr_keyboard.h>
#include <wlr/types/wlr_keyboard_group.h>
#include <wlr/types/wlr_seat.h>
@ -21,6 +21,10 @@
#include "view.h"
#include "workspaces.h"
#if WLR_HAS_SESSION
#include <wlr/backend/session.h>
#endif
enum lab_key_handled {
LAB_KEY_HANDLED_FALSE = 0,
LAB_KEY_HANDLED_TRUE = 1,
@ -54,7 +58,9 @@ keyboard_reset_current_keybind(void)
static void
change_vt(unsigned int vt)
{
#if WLR_HAS_SESSION
wlr_session_change_vt(server.session, vt);
#endif
}
uint32_t
@ -745,7 +751,18 @@ set_layout(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);
enum xkb_context_flags ctx_flags = XKB_CONTEXT_NO_FLAGS;
#ifdef __ANDROID__
/*
* Android's bionic libc implements secure_getenv() as a function
* that always returns NULL (the app process has no AT_SECURE).
* This prevents xkbcommon from reading XKB_DEFAULT_LAYOUT and
* friends via secure_getenv(). Use the flag to fall back to
* regular getenv() which works fine on Android.
*/
ctx_flags |= XKB_CONTEXT_NO_SECURE_GETENV;
#endif
struct xkb_context *context = xkb_context_new(ctx_flags);
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
XKB_KEYMAP_COMPILE_NO_FLAGS);

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "input/tablet-pad.h"
#include <stdlib.h>
#include <wlr/backend/libinput.h>
#include <wlr/config.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_v2.h>
@ -14,6 +14,12 @@
#include "input/tablet.h"
#include "labwc.h"
#if WLR_HAS_LIBINPUT_BACKEND
#include <wlr/backend/libinput.h>
#else
#define wlr_input_device_is_libinput(device) (false)
#endif
void
tablet_pad_attach_tablet(struct seat *seat)
{
@ -34,7 +40,7 @@ tablet_pad_attach_tablet(struct seat *seat)
*/
continue;
}
#if WLR_HAS_LIBINPUT_BACKEND
struct libinput_device *tablet_device =
wlr_libinput_get_device_handle(tablet->wlr_input_device);
struct libinput_device_group *tablet_group =
@ -55,6 +61,7 @@ tablet_pad_attach_tablet(struct seat *seat)
pad->tablet = tablet;
}
}
#endif
}
}

View file

@ -2,11 +2,13 @@
#include "input/tablet.h"
#include <stdlib.h>
#include <linux/input-event-codes.h>
#include <wlr/config.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/util/log.h>
#include "common/macros.h"
#include "common/mem.h"
#include "common/scene-helpers.h"
@ -20,6 +22,10 @@
#include "action.h"
#include "view.h"
#if WLR_HAS_LIBINPUT_BACKEND
#include <wlr/backend/libinput.h>
#endif
bool
tablet_tool_has_focused_surface(struct seat *seat)
{
@ -336,6 +342,29 @@ handle_tablet_tool_proximity(struct wl_listener *listener, void *data)
tool = tablet_tool_create(tablet->seat, ev->tool);
}
#if WLR_HAS_LIBINPUT_BACKEND
struct libinput_tablet_tool *libinput_tool =
wlr_libinput_get_tablet_tool_handle(tool->tool_v2->wlr_tool);
/*
* Configure tool pressure range using libinput. Note that a runtime change
* needs two proximity-in events. First one is for applying the pressure range
* here and second one until it is effectively applied, probably because of
* how lininput applies pressure range changes internally.
*/
if (libinput_tablet_tool_config_pressure_range_is_available(libinput_tool) > 0
&& rc.tablet_tool.min_pressure >= 0.0
&& rc.tablet_tool.max_pressure <= 1.0) {
double min = libinput_tablet_tool_config_pressure_range_get_minimum(libinput_tool);
double max = libinput_tablet_tool_config_pressure_range_get_maximum(libinput_tool);
if (min != rc.tablet_tool.min_pressure || max != rc.tablet_tool.max_pressure) {
wlr_log(WLR_INFO, "tablet tool pressure range configured");
libinput_tablet_tool_config_pressure_range_set(libinput_tool,
rc.tablet_tool.min_pressure, rc.tablet_tool.max_pressure);
}
}
#endif
/*
* Enforce mouse emulation when the current tool is a tablet mouse.
* Client support for tablet mouses in tablet mode is often incomplete

View file

@ -10,11 +10,9 @@
#include "output.h"
#include <assert.h>
#include <strings.h>
#include <wlr/backend/drm.h>
#include <wlr/backend/wayland.h>
#include <wlr/config.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_drm_lease_v1.h>
#include <wlr/types/wlr_ext_workspace_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_output.h>
@ -39,7 +37,18 @@
#include "xwayland.h"
#if WLR_HAS_X11_BACKEND
#include <wlr/backend/x11.h>
#include <wlr/backend/x11.h>
#endif
#if WLR_HAS_DRM_BACKEND
#include <wlr/backend/drm.h>
#include <wlr/types/wlr_drm_lease_v1.h>
#else
#define wlr_output_is_drm(output) (false)
#endif
#if WLR_HAS_SESSION
#include <wlr/backend/session.h>
#endif
bool
@ -93,12 +102,14 @@ handle_output_frame(struct wl_listener *listener, void *data)
return;
}
#if WLR_HAS_SESSION
/*
* skip painting the session when it exists but is not active.
*/
if (server.session && !server.session->active) {
return;
}
#endif
struct wlr_scene_output *scene_output = output->scene_output;
struct wlr_output_state *pending = &output->pending;
@ -452,14 +463,8 @@ handle_new_output(struct wl_listener *listener, void *data)
* This is also useful for debugging the DRM parts of
* another compositor.
*
* All drm leasing is disabled due to a UAF bug in wlroots.
* We assume that the fix will be backported to 0.19.1 and thus
* check for a version >= 0.19.1. See following link for the fix status:
* https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5104
*
* TODO: remove once labwc starts tracking 0.20.x and the fix has been merged.
*/
#if LAB_WLR_VERSION_AT_LEAST(0, 19, 1)
#if WLR_HAS_DRM_BACKEND
if (server.drm_lease_manager && wlr_output_is_drm(wlr_output)) {
wlr_drm_lease_v1_manager_offer_output(
server.drm_lease_manager, wlr_output);

View file

@ -2,7 +2,7 @@
#include <assert.h>
#include <stdbool.h>
#include <strings.h>
#include <wlr/backend/libinput.h>
#include <wlr/config.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
@ -31,6 +31,12 @@
#include "session-lock.h"
#include "view.h"
#if WLR_HAS_LIBINPUT_BACKEND
#include <wlr/backend/libinput.h>
#else
#define wlr_input_device_is_libinput(device) (false)
#endif
static void
input_device_destroy(struct wl_listener *listener, void *data)
{
@ -48,6 +54,7 @@ input_device_destroy(struct wl_listener *listener, void *data)
free(input);
}
#if WLR_HAS_LIBINPUT_BACKEND
static enum lab_libinput_device_type
device_type_from_wlr_device(struct wlr_input_device *wlr_input_device)
{
@ -101,6 +108,7 @@ get_category(struct wlr_input_device *device)
/* Use default profile as a fallback */
return libinput_category_get_default();
}
#endif
static void
configure_libinput(struct wlr_input_device *wlr_input_device)
@ -135,7 +143,7 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
input->scroll_factor = 1.0;
return;
}
#if WLR_HAS_LIBINPUT_BACKEND
struct libinput_device *libinput_dev =
wlr_libinput_get_device_handle(wlr_input_device);
if (!libinput_dev) {
@ -347,6 +355,7 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
wlr_log(WLR_INFO, "scroll factor configured (%g)", dc->scroll_factor);
input->scroll_factor = dc->scroll_factor;
#endif
}
static struct wlr_output *

View file

@ -6,6 +6,7 @@
#include <sys/wait.h>
#include <wlr/backend/headless.h>
#include <wlr/backend/multi.h>
#include <wlr/config.h>
#include <wlr/render/allocator.h>
#include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_color_management_v1.h>
@ -13,7 +14,6 @@
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_drm.h>
#include <wlr/types/wlr_drm_lease_v1.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_ext_data_control_v1.h>
#include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h>
@ -43,8 +43,11 @@
#include <wlr/types/wlr_xdg_foreign_v2.h>
#if HAVE_XWAYLAND
#include <wlr/xwayland.h>
#include "xwayland-shell-v1-protocol.h"
#include <wlr/xwayland.h>
#endif
#if WLR_HAS_DRM_BACKEND
#include <wlr/types/wlr_drm_lease_v1.h>
#endif
#include "action.h"
@ -195,6 +198,7 @@ handle_sigchld(int signal, void *data)
return 0;
}
#if WLR_HAS_DRM_BACKEND
static void
handle_drm_lease_request(struct wl_listener *listener, void *data)
{
@ -206,6 +210,7 @@ handle_drm_lease_request(struct wl_listener *listener, void *data)
return;
}
}
#endif
static bool
protocol_is_privileged(const struct wl_interface *iface)
@ -310,7 +315,11 @@ server_global_filter(const struct wl_client *client, const struct wl_global *glo
? server.xwayland->server->client
: NULL;
if (client != xwayland_client && !strcmp(iface->name, xwayland_shell_v1_interface.name)) {
/*
* The interface name `xwayland_shell_v1_interface.name` is hard-coded
* here to avoid generating and including `xwayland-shell-v1-protocol.h`
*/
if (client != xwayland_client && !strcmp(iface->name, "xwayland_shell_v1")) {
/* Filter out the xwayland shell for usual clients */
return false;
}
@ -732,6 +741,7 @@ server_init(void)
session_lock_init();
#if WLR_HAS_DRM_BACKEND
server.drm_lease_manager = wlr_drm_lease_v1_manager_create(
server.wl_display, server.backend);
if (server.drm_lease_manager) {
@ -742,6 +752,7 @@ server_init(void)
wlr_log(WLR_DEBUG, "Failed to create wlr_drm_lease_device_v1");
wlr_log(WLR_INFO, "VR will not be available");
}
#endif
server.output_power_manager_v1 =
wlr_output_power_manager_v1_create(server.wl_display);