make wlroots libinput backend optional

This commit is contained in:
Consolatis 2026-03-29 20:31:33 +02:00
parent dfbea3e156
commit 8c6faa010f
4 changed files with 34 additions and 7 deletions

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

@ -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,7 +2,7 @@
#include "input/tablet.h"
#include <stdlib.h>
#include <linux/input-event-codes.h>
#include "wlr/backend/libinput.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>
@ -22,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)
{
@ -338,6 +342,7 @@ 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);
@ -358,6 +363,7 @@ handle_tablet_tool_proximity(struct wl_listener *listener, void *data)
rc.tablet_tool.min_pressure, rc.tablet_tool.max_pressure);
}
}
#endif
/*
* Enforce mouse emulation when the current tool is a tablet mouse.