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

@ -121,7 +121,7 @@ jobs:
xbps-install -Syu xbps-install -Syu
xbps-install -y git meson gcc clang pkg-config scdoc \ xbps-install -y git meson gcc clang pkg-config scdoc \
cairo-devel glib-devel libpng-devel librsvg-devel libxml2-devel \ cairo-devel glib-devel libpng-devel librsvg-devel libxml2-devel \
pango-devel wlroots0.19-devel gdb bash xorg-server-xwayland \ pango-devel wlroots0.20-devel gdb bash xorg-server-xwayland \
dejavu-fonts-ttf libsfdo-devel foot hwids dejavu-fonts-ttf libsfdo-devel foot hwids
# These builds are executed on all runners # These builds are executed on all runners
@ -210,6 +210,19 @@ jobs:
meson compile -C build-gcc-no-feature meson compile -C build-gcc-no-feature
' | $TARGET ' | $TARGET
# No backend build, run on Arch only
- name: Build with gcc - no-backends test
if: matrix.name == 'Arch'
run: |
echo '
cd "$GITHUB_WORKSPACE"
export CC=gcc
meson setup build-gcc-no-backends \
-Dwlroots:backends= -Dwlroots:session=disabled --werror \
--force-fallback-for=wlroots
meson compile -C build-gcc-no-backends
' | $TARGET
# Unit tests, run on Arch only # Unit tests, run on Arch only
- name: Build with gcc - unit test - name: Build with gcc - unit test
if: matrix.name == 'Arch' if: matrix.name == 'Arch'

32
NEWS.md
View file

@ -9,7 +9,7 @@ The format is based on [Keep a Changelog]
| Date | All Changes | wlroots version | lines-of-code | | Date | All Changes | wlroots version | lines-of-code |
|------------|---------------|-----------------|---------------| |------------|---------------|-----------------|---------------|
| 2026-03-15 | [unreleased] | 0.19.2 | 29244 | | 2026-03-31 | [unreleased] | 0.20.0 | 27402 |
| 2026-03-15 | [0.9.6] | 0.19.2 | 29271 | | 2026-03-15 | [0.9.6] | 0.19.2 | 29271 |
| 2026-03-04 | [0.9.5] | 0.19.2 | 29251 | | 2026-03-04 | [0.9.5] | 0.19.2 | 29251 |
| 2026-02-27 | [0.9.4] | 0.19.2 | 29225 | | 2026-02-27 | [0.9.4] | 0.19.2 | 29225 |
@ -115,8 +115,27 @@ There are some regression warnings worth noting for the switch to wlroots 0.19:
[unreleased-commits] [unreleased-commits]
The codebase has been ported to wlroots 0.20 [#2956] @Consolatis
### Added
- Add configuration option `<tabletTool minPressure="0.0" maxPressure="1.0" />`
to enable tablet tool pressure range libinput settings [#2916] @jp7677
- Add `wl_fixes` interface [#2956] @kode54
### Fixed ### Fixed
- Gracefully handle missing XWayland packages, so that a labwc compositor which
has been built with XWayland support (which is optional) can be run even if
XWayland is not installed. [#3401] @quite
- Rework how XWayland window initial geometry is set to ensure that the natural
geometry does not exceed the usable output area when handling initial
maximize/fullscreen requests. [#3439] @jlindgren90.
- For XWayland windows, sync always-on-top state back to X.Org Server. This
makes `wmctrl -b toggle,above` work. [#3446] @jlindgren90
- Fix missing title and icon with XWayland client override-redirect toggle.
There are no known issues with clients, so this is purely for preventative
purposes. [#3450] @jlindgren90
- Update titlebar title when set to empty and fix an associated issue causing - Update titlebar title when set to empty and fix an associated issue causing
the title to be misplaced outside of the titlebar when the window is resized. the title to be misplaced outside of the titlebar when the window is resized.
[#3443] @tokyo4j [#3443] @tokyo4j
@ -127,6 +146,10 @@ There are some regression warnings worth noting for the switch to wlroots 0.19:
- Allow policy-based placement to apply when an initially-maximized/fullscreen - Allow policy-based placement to apply when an initially-maximized/fullscreen
view is restored to floating geometry. [#3387] @jlindgren90 view is restored to floating geometry. [#3387] @jlindgren90
### Changed
- Drop cosmic-workspace protocol [#3031] @tokyo4j
## 0.9.6 - 2026-03-15 ## 0.9.6 - 2026-03-15
[0.9.6-commits] [0.9.6-commits]
@ -3098,6 +3121,7 @@ Compile with wlroots 0.12.0 and wayland-server >=1.16
[#2909]: https://github.com/labwc/labwc/pull/2909 [#2909]: https://github.com/labwc/labwc/pull/2909
[#2910]: https://github.com/labwc/labwc/pull/2910 [#2910]: https://github.com/labwc/labwc/pull/2910
[#2914]: https://github.com/labwc/labwc/pull/2914 [#2914]: https://github.com/labwc/labwc/pull/2914
[#2916]: https://github.com/labwc/labwc/pull/2916
[#2933]: https://github.com/labwc/labwc/pull/2933 [#2933]: https://github.com/labwc/labwc/pull/2933
[#2937]: https://github.com/labwc/labwc/pull/2937 [#2937]: https://github.com/labwc/labwc/pull/2937
[#2939]: https://github.com/labwc/labwc/pull/2939 [#2939]: https://github.com/labwc/labwc/pull/2939
@ -3105,6 +3129,7 @@ Compile with wlroots 0.12.0 and wayland-server >=1.16
[#2943]: https://github.com/labwc/labwc/pull/2943 [#2943]: https://github.com/labwc/labwc/pull/2943
[#2944]: https://github.com/labwc/labwc/pull/2944 [#2944]: https://github.com/labwc/labwc/pull/2944
[#2948]: https://github.com/labwc/labwc/pull/2948 [#2948]: https://github.com/labwc/labwc/pull/2948
[#2956]: https://github.com/labwc/labwc/pull/2956
[#2965]: https://github.com/labwc/labwc/pull/2965 [#2965]: https://github.com/labwc/labwc/pull/2965
[#2967]: https://github.com/labwc/labwc/pull/2967 [#2967]: https://github.com/labwc/labwc/pull/2967
[#2970]: https://github.com/labwc/labwc/pull/2970 [#2970]: https://github.com/labwc/labwc/pull/2970
@ -3122,6 +3147,7 @@ Compile with wlroots 0.12.0 and wayland-server >=1.16
[#3020]: https://github.com/labwc/labwc/pull/3020 [#3020]: https://github.com/labwc/labwc/pull/3020
[#3024]: https://github.com/labwc/labwc/pull/3024 [#3024]: https://github.com/labwc/labwc/pull/3024
[#3028]: https://github.com/labwc/labwc/pull/3028 [#3028]: https://github.com/labwc/labwc/pull/3028
[#3031]: https://github.com/labwc/labwc/pull/3031
[#3033]: https://github.com/labwc/labwc/pull/3033 [#3033]: https://github.com/labwc/labwc/pull/3033
[#3039]: https://github.com/labwc/labwc/pull/3039 [#3039]: https://github.com/labwc/labwc/pull/3039
[#3042]: https://github.com/labwc/labwc/pull/3042 [#3042]: https://github.com/labwc/labwc/pull/3042
@ -3189,6 +3215,7 @@ Compile with wlroots 0.12.0 and wayland-server >=1.16
[#3373]: https://github.com/labwc/labwc/pull/3373 [#3373]: https://github.com/labwc/labwc/pull/3373
[#3387]: https://github.com/labwc/labwc/pull/3387 [#3387]: https://github.com/labwc/labwc/pull/3387
[#3400]: https://github.com/labwc/labwc/pull/3400 [#3400]: https://github.com/labwc/labwc/pull/3400
[#3401]: https://github.com/labwc/labwc/pull/3401
[#3406]: https://github.com/labwc/labwc/pull/3406 [#3406]: https://github.com/labwc/labwc/pull/3406
[#3410]: https://github.com/labwc/labwc/pull/3410 [#3410]: https://github.com/labwc/labwc/pull/3410
[#3411]: https://github.com/labwc/labwc/pull/3411 [#3411]: https://github.com/labwc/labwc/pull/3411
@ -3198,7 +3225,10 @@ Compile with wlroots 0.12.0 and wayland-server >=1.16
[#3428]: https://github.com/labwc/labwc/pull/3428 [#3428]: https://github.com/labwc/labwc/pull/3428
[#3429]: https://github.com/labwc/labwc/pull/3429 [#3429]: https://github.com/labwc/labwc/pull/3429
[#3430]: https://github.com/labwc/labwc/pull/3430 [#3430]: https://github.com/labwc/labwc/pull/3430
[#3439]: https://github.com/labwc/labwc/pull/3439
[#3440]: https://github.com/labwc/labwc/pull/3440 [#3440]: https://github.com/labwc/labwc/pull/3440
[#3441]: https://github.com/labwc/labwc/pull/3441 [#3441]: https://github.com/labwc/labwc/pull/3441
[#3443]: https://github.com/labwc/labwc/pull/3443 [#3443]: https://github.com/labwc/labwc/pull/3443
[#3445]: https://github.com/labwc/labwc/pull/3445 [#3445]: https://github.com/labwc/labwc/pull/3445
[#3446]: https://github.com/labwc/labwc/pull/3446
[#3450]: https://github.com/labwc/labwc/pull/3450

View file

@ -206,6 +206,16 @@ static void
get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height, get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...) int *baseline, double scale, bool markup, const char *fmt, ...)
{ {
if (width) {
*width = 0;
}
if (height) {
*height = 0;
}
if (baseline) {
*baseline = 0;
}
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
gchar *buf = g_strdup_vprintf(fmt, args); gchar *buf = g_strdup_vprintf(fmt, args);

View file

@ -1,59 +1,61 @@
wayland_client = dependency('wayland-client') if get_option('labnag').allowed()
wayland_cursor = dependency('wayland-cursor') wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
nag_sources = files( nag_sources = files(
'labnag.c', 'labnag.c',
'pool-buffer.c', 'pool-buffer.c',
)
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
protocols = [
wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
'../protocols/wlr-layer-shell-unstable-v1.xml',
]
foreach xml : protocols
nag_sources += custom_target(
xml.underscorify() + '_c',
input: xml,
output: '@BASENAME@-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
) )
nag_sources += custom_target(
xml.underscorify() + '_client_h',
input: xml,
output: '@BASENAME@-client-protocol.h',
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
)
endforeach
if host_machine.system() in ['freebsd', 'openbsd'] wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
# For signalfd()
epoll_dep = dependency('epoll-shim') protocols = [
else wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
epoll_dep = [] wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
'../protocols/wlr-layer-shell-unstable-v1.xml',
]
foreach xml : protocols
nag_sources += custom_target(
xml.underscorify() + '_c',
input: xml,
output: '@BASENAME@-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
)
nag_sources += custom_target(
xml.underscorify() + '_client_h',
input: xml,
output: '@BASENAME@-client-protocol.h',
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
)
endforeach
if host_machine.system() in ['freebsd', 'openbsd']
# For signalfd()
epoll_dep = dependency('epoll-shim')
else
epoll_dep = []
endif
executable(
'labnag',
nag_sources,
dependencies: [
cairo,
pangocairo,
glib,
wayland_client,
wayland_cursor,
wlroots,
server_protos,
epoll_dep,
xkbcommon,
],
include_directories: [labwc_inc],
install: true,
)
endif endif
executable(
'labnag',
nag_sources,
dependencies: [
cairo,
pangocairo,
glib,
wayland_client,
wayland_cursor,
wlroots,
server_protos,
epoll_dep,
xkbcommon,
],
include_directories: [labwc_inc],
install: true,
)
clients = files('lab-sensible-terminal') clients = files('lab-sensible-terminal')
install_data(clients, install_dir: get_option('bindir')) install_data(clients, install_dir: get_option('bindir'))

View file

@ -1090,7 +1090,8 @@ Note: To rotate touch events with output rotation, use the libinput
## TABLET TOOL ## TABLET TOOL
``` ```
<tabletTool motion="absolute" relativeMotionSensitivity="1" /> <tabletTool motion="absolute" relativeMotionSensitivity="1.0"
minPressure="0.0" maxPressure="1.0" />
``` ```
*<tabletTool motion="">* [absolute|relative] *<tabletTool motion="">* [absolute|relative]
@ -1105,6 +1106,16 @@ Note: To rotate touch events with output rotation, use the libinput
speed, using a value greater than 1.0 increases the speed of the speed, using a value greater than 1.0 increases the speed of the
cursor. The default is "1.0". cursor. The default is "1.0".
*<tabletTool minPressure="">*
*<tabletTool maxPressure="">*
The pressure range of a tablet tool can be controlled by adjusting
*minPressure* and *maxPressure*. Setting the minimum pressure to
a value greater than zero requires more pressure for the tip
threshold, setting the maximum pressure to a value less than 1.0
requires less pressure for the user before the maximum is reached.
The default is 0 for the minimum pressure and 1.0 for the maximum
pressure.
## LIBINPUT ## LIBINPUT
``` ```

View file

@ -573,8 +573,11 @@
*relativeMotionSensitivity* controls the speed of the cursor. Using *relativeMotionSensitivity* controls the speed of the cursor. Using
a value lower than 1.0 decreases the speed, using a value greater than a value lower than 1.0 decreases the speed, using a value greater than
1.0 increases the speed of the cursor. 1.0 increases the speed of the cursor.
The pressure range of a tablet tool can be controlled by adjusting
*minPressure* and *maxPressure*.
--> -->
<tabletTool motion="absolute" relativeMotionSensitivity="1.0" /> <tabletTool motion="absolute" relativeMotionSensitivity="1.0"
minPressure="0.0" maxPressure="1.0" />
<!-- <!--
The *category* attribute is optional and can be set to touch, touchpad, The *category* attribute is optional and can be set to touch, touchpad,

View file

@ -144,6 +144,8 @@ struct rcxml {
struct tablet_tool_config { struct tablet_tool_config {
enum lab_motion motion; enum lab_motion motion;
double relative_motion_sensitivity; double relative_motion_sensitivity;
double min_pressure;
double max_pressure;
} tablet_tool; } tablet_tool;
/* libinput */ /* libinput */

View file

@ -65,13 +65,13 @@ xkbcommon = dependency('xkbcommon')
xcb = dependency('xcb', required: get_option('xwayland')) xcb = dependency('xcb', required: get_option('xwayland'))
xcb_ewmh = dependency('xcb-ewmh', required: get_option('xwayland')) xcb_ewmh = dependency('xcb-ewmh', required: get_option('xwayland'))
xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland'))
drm_full = dependency('libdrm') drm_full = dependency('libdrm', required: wlroots.get_variable('have_drm_backend') == 'true')
drm = drm_full.partial_dependency(compile_args: true, includes: true) drm = drm_full.partial_dependency(compile_args: true, includes: true)
xml2 = dependency('libxml-2.0') xml2 = dependency('libxml-2.0')
glib = dependency('glib-2.0') glib = dependency('glib-2.0')
cairo = dependency('cairo') cairo = dependency('cairo')
pangocairo = dependency('pangocairo') pangocairo = dependency('pangocairo')
input = dependency('libinput', version: '>=1.14') input = dependency('libinput', version: '>=1.26', required: wlroots.get_variable('have_libinput_backend') == 'true')
pixman = dependency('pixman-1') pixman = dependency('pixman-1')
math = cc.find_library('m') math = cc.find_library('m')
png = dependency('libpng') png = dependency('libpng')

View file

@ -2,6 +2,7 @@ option('man-pages', type: 'feature', value: 'auto', description: 'Generate and i
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
option('svg', type: 'feature', value: 'enabled', description: 'Enable svg window buttons') option('svg', type: 'feature', value: 'enabled', description: 'Enable svg window buttons')
option('icon', type: 'feature', value: 'enabled', description: 'Enable window icons') option('icon', type: 'feature', value: 'enabled', description: 'Enable window icons')
option('labnag', type: 'feature', value: 'auto', description: 'Build labnag notification daemon')
option('nls', type: 'feature', value: 'auto', description: 'Enable native language support') option('nls', type: 'feature', value: 'auto', description: 'Enable native language support')
option('static_analyzer', type: 'feature', value: 'disabled', description: 'Run gcc static analyzer') option('static_analyzer', type: 'feature', value: 'disabled', description: 'Run gcc static analyzer')
option('test', type: 'feature', value: 'disabled', description: 'Run tests') option('test', type: 'feature', value: 'disabled', description: 'Run tests')

View file

@ -14,18 +14,6 @@ wayland_scanner_server = generator(
) )
server_protocols = [ server_protocols = [
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
wl_protocol_dir / 'staging/drm-lease/drm-lease-v1.xml',
wl_protocol_dir / 'staging/xwayland-shell/xwayland-shell-v1.xml',
wl_protocol_dir / 'staging/tearing-control/tearing-control-v1.xml',
wl_protocol_dir / 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml',
wl_protocol_dir / 'staging/ext-workspace/ext-workspace-v1.xml',
wl_protocol_dir / 'staging/ext-image-capture-source/ext-image-capture-source-v1.xml',
wl_protocol_dir / 'staging/ext-image-copy-capture/ext-image-copy-capture-v1.xml',
wl_protocol_dir / 'staging/color-management/color-management-v1.xml',
'wlr-layer-shell-unstable-v1.xml', 'wlr-layer-shell-unstable-v1.xml',
'wlr-output-power-management-unstable-v1.xml', 'wlr-output-power-management-unstable-v1.xml',
] ]

View file

@ -1355,6 +1355,12 @@ entry(xmlNode *node, char *nodename, char *content)
} else if (!strcasecmp(nodename, "relativeMotionSensitivity.tabletTool")) { } else if (!strcasecmp(nodename, "relativeMotionSensitivity.tabletTool")) {
rc.tablet_tool.relative_motion_sensitivity = rc.tablet_tool.relative_motion_sensitivity =
tablet_get_dbl_if_positive(content, "relativeMotionSensitivity"); 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")) { } else if (!strcasecmp(nodename, "ignoreButtonReleasePeriod.menu")) {
rc.menu_ignore_button_release_period = atoi(content); rc.menu_ignore_button_release_period = atoi(content);
} else if (!strcasecmp(nodename, "showIcons.menu")) { } else if (!strcasecmp(nodename, "showIcons.menu")) {
@ -1475,6 +1481,8 @@ rcxml_init(void)
tablet_load_default_button_mappings(); tablet_load_default_button_mappings();
rc.tablet_tool.motion = LAB_MOTION_ABSOLUTE; rc.tablet_tool.motion = LAB_MOTION_ABSOLUTE;
rc.tablet_tool.relative_motion_sensitivity = 1.0; 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_rate = 25;
rc.repeat_delay = 600; rc.repeat_delay = 600;

View file

@ -8,8 +8,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <wlr/backend/drm.h>
#include <wlr/backend/multi.h> #include <wlr/backend/multi.h>
#include <wlr/config.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "common/buf.h" #include "common/buf.h"
#include "common/dir.h" #include "common/dir.h"
@ -20,6 +20,12 @@
#include "config/rcxml.h" #include "config/rcxml.h"
#include "labwc.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[] = { static const char *const env_vars[] = {
"WAYLAND_DISPLAY", "WAYLAND_DISPLAY",
"XDG_CURRENT_DESKTOP", "XDG_CURRENT_DESKTOP",

View file

@ -3,7 +3,7 @@
#include "input/cursor.h" #include "input/cursor.h"
#include <assert.h> #include <assert.h>
#include <time.h> #include <time.h>
#include <wlr/backend/libinput.h> #include <wlr/config.h>
#include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_cursor_shape_v1.h> #include <wlr/types/wlr_cursor_shape_v1.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
@ -38,6 +38,10 @@
#include "view.h" #include "view.h"
#include "xwayland.h" #include "xwayland.h"
#if WLR_HAS_LIBINPUT_BACKEND
#include <wlr/backend/libinput.h>
#endif
#define LAB_CURSOR_SHAPE_V1_VERSION 1 #define LAB_CURSOR_SHAPE_V1_VERSION 1
struct constraint { 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) 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)) { if (wlr_input_device_is_libinput(wlr_input_device)) {
struct libinput_device *libinput_device = struct libinput_device *libinput_device =
wlr_libinput_get_device_handle(wlr_input_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; return -1.0;
} }
} }
#endif
return 1.0; return 1.0;
} }

View file

@ -3,7 +3,7 @@
#include "input/keyboard.h" #include "input/keyboard.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <wlr/backend/session.h> #include <wlr/config.h>
#include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_keyboard.h>
#include <wlr/types/wlr_keyboard_group.h> #include <wlr/types/wlr_keyboard_group.h>
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
@ -21,6 +21,10 @@
#include "view.h" #include "view.h"
#include "workspaces.h" #include "workspaces.h"
#if WLR_HAS_SESSION
#include <wlr/backend/session.h>
#endif
enum lab_key_handled { enum lab_key_handled {
LAB_KEY_HANDLED_FALSE = 0, LAB_KEY_HANDLED_FALSE = 0,
LAB_KEY_HANDLED_TRUE = 1, LAB_KEY_HANDLED_TRUE = 1,
@ -54,7 +58,9 @@ keyboard_reset_current_keybind(void)
static void static void
change_vt(unsigned int vt) change_vt(unsigned int vt)
{ {
#if WLR_HAS_SESSION
wlr_session_change_vt(server.session, vt); wlr_session_change_vt(server.session, vt);
#endif
} }
uint32_t uint32_t
@ -745,7 +751,18 @@ set_layout(struct wlr_keyboard *kb)
static bool fallback_mode; static bool fallback_mode;
struct xkb_rule_names rules = { 0 }; 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, struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
XKB_KEYMAP_COMPILE_NO_FLAGS); XKB_KEYMAP_COMPILE_NO_FLAGS);

View file

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

View file

@ -2,11 +2,13 @@
#include "input/tablet.h" #include "input/tablet.h"
#include <stdlib.h> #include <stdlib.h>
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <wlr/config.h>
#include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_tablet_tool.h> #include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_tablet_v2.h> #include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/types/wlr_scene.h> #include <wlr/types/wlr_scene.h>
#include <wlr/util/log.h>
#include "common/macros.h" #include "common/macros.h"
#include "common/mem.h" #include "common/mem.h"
#include "common/scene-helpers.h" #include "common/scene-helpers.h"
@ -20,6 +22,10 @@
#include "action.h" #include "action.h"
#include "view.h" #include "view.h"
#if WLR_HAS_LIBINPUT_BACKEND
#include <wlr/backend/libinput.h>
#endif
bool bool
tablet_tool_has_focused_surface(struct seat *seat) 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); 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. * Enforce mouse emulation when the current tool is a tablet mouse.
* Client support for tablet mouses in tablet mode is often incomplete * Client support for tablet mouses in tablet mode is often incomplete

View file

@ -10,11 +10,9 @@
#include "output.h" #include "output.h"
#include <assert.h> #include <assert.h>
#include <strings.h> #include <strings.h>
#include <wlr/backend/drm.h>
#include <wlr/backend/wayland.h> #include <wlr/backend/wayland.h>
#include <wlr/config.h> #include <wlr/config.h>
#include <wlr/types/wlr_cursor.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_ext_workspace_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
@ -39,7 +37,18 @@
#include "xwayland.h" #include "xwayland.h"
#if WLR_HAS_X11_BACKEND #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 #endif
bool bool
@ -93,12 +102,14 @@ handle_output_frame(struct wl_listener *listener, void *data)
return; return;
} }
#if WLR_HAS_SESSION
/* /*
* skip painting the session when it exists but is not active. * skip painting the session when it exists but is not active.
*/ */
if (server.session && !server.session->active) { if (server.session && !server.session->active) {
return; return;
} }
#endif
struct wlr_scene_output *scene_output = output->scene_output; struct wlr_scene_output *scene_output = output->scene_output;
struct wlr_output_state *pending = &output->pending; 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 * This is also useful for debugging the DRM parts of
* another compositor. * 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)) { if (server.drm_lease_manager && wlr_output_is_drm(wlr_output)) {
wlr_drm_lease_v1_manager_offer_output( wlr_drm_lease_v1_manager_offer_output(
server.drm_lease_manager, wlr_output); server.drm_lease_manager, wlr_output);

View file

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

View file

@ -6,6 +6,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <wlr/backend/headless.h> #include <wlr/backend/headless.h>
#include <wlr/backend/multi.h> #include <wlr/backend/multi.h>
#include <wlr/config.h>
#include <wlr/render/allocator.h> #include <wlr/render/allocator.h>
#include <wlr/types/wlr_alpha_modifier_v1.h> #include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_color_management_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_control_v1.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_drm.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_export_dmabuf_v1.h>
#include <wlr/types/wlr_ext_data_control_v1.h> #include <wlr/types/wlr_ext_data_control_v1.h>
#include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h> #include <wlr/types/wlr_ext_foreign_toplevel_list_v1.h>
@ -43,8 +43,11 @@
#include <wlr/types/wlr_xdg_foreign_v2.h> #include <wlr/types/wlr_xdg_foreign_v2.h>
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
#include <wlr/xwayland.h> #include <wlr/xwayland.h>
#include "xwayland-shell-v1-protocol.h" #endif
#if WLR_HAS_DRM_BACKEND
#include <wlr/types/wlr_drm_lease_v1.h>
#endif #endif
#include "action.h" #include "action.h"
@ -195,6 +198,7 @@ handle_sigchld(int signal, void *data)
return 0; return 0;
} }
#if WLR_HAS_DRM_BACKEND
static void static void
handle_drm_lease_request(struct wl_listener *listener, void *data) 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; return;
} }
} }
#endif
static bool static bool
protocol_is_privileged(const struct wl_interface *iface) 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 ? server.xwayland->server->client
: NULL; : 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 */ /* Filter out the xwayland shell for usual clients */
return false; return false;
} }
@ -732,6 +741,7 @@ server_init(void)
session_lock_init(); session_lock_init();
#if WLR_HAS_DRM_BACKEND
server.drm_lease_manager = wlr_drm_lease_v1_manager_create( server.drm_lease_manager = wlr_drm_lease_v1_manager_create(
server.wl_display, server.backend); server.wl_display, server.backend);
if (server.drm_lease_manager) { 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_DEBUG, "Failed to create wlr_drm_lease_device_v1");
wlr_log(WLR_INFO, "VR will not be available"); wlr_log(WLR_INFO, "VR will not be available");
} }
#endif
server.output_power_manager_v1 = server.output_power_manager_v1 =
wlr_output_power_manager_v1_create(server.wl_display); wlr_output_power_manager_v1_create(server.wl_display);