mirror of
https://github.com/labwc/labwc.git
synced 2026-04-03 07:15:34 -04:00
make wlroots libinput backend optional
This commit is contained in:
parent
dfbea3e156
commit
8c6faa010f
4 changed files with 34 additions and 7 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#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/backend/libinput.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>
|
||||||
|
|
@ -22,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)
|
||||||
{
|
{
|
||||||
|
|
@ -338,6 +342,7 @@ 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 =
|
struct libinput_tablet_tool *libinput_tool =
|
||||||
wlr_libinput_get_tablet_tool_handle(tool->tool_v2->wlr_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);
|
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.
|
||||||
|
|
|
||||||
13
src/seat.c
13
src/seat.c
|
|
@ -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 *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue