From 6def1319d1e60d520e70a5237793fe9f09a24ed6 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Wed, 17 Jan 2024 19:01:06 +0100 Subject: [PATCH] input: move function to config This function is only about rc, so fits better in config. --- include/config/tablet.h | 1 + include/input/tablet.h | 1 - src/config/tablet.c | 14 ++++++++++++++ src/input/tablet.c | 14 -------------- src/input/tablet_pad.c | 1 - 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/config/tablet.h b/include/config/tablet.h index 6498b91c..8e0c7c67 100644 --- a/include/config/tablet.h +++ b/include/config/tablet.h @@ -22,5 +22,6 @@ enum rotation tablet_parse_rotation(int value); uint32_t tablet_button_from_str(const char *button); void tablet_button_mapping_add(uint32_t from, uint32_t to); void tablet_load_default_button_mappings(void); +uint32_t tablet_get_mapped_button(uint32_t src_button); #endif /* LABWC_TABLET_CONFIG_H */ diff --git a/include/input/tablet.h b/include/input/tablet.h index c5f5a8e9..d0678c06 100644 --- a/include/input/tablet.h +++ b/include/input/tablet.h @@ -21,7 +21,6 @@ struct drawing_tablet { } handlers; }; -uint32_t tablet_get_mapped_button(uint32_t src_button); void tablet_init(struct seat *seat, struct wlr_input_device *wlr_input_device); #endif /* LABWC_TABLET_H */ diff --git a/src/config/tablet.c b/src/config/tablet.c index 8ac6a0b5..95e253cf 100644 --- a/src/config/tablet.c +++ b/src/config/tablet.c @@ -105,3 +105,17 @@ tablet_load_default_button_mappings(void) tablet_button_mapping_add(BTN_STYLUS, BTN_RIGHT); tablet_button_mapping_add(BTN_STYLUS2, BTN_MIDDLE); } + +uint32_t +tablet_get_mapped_button(uint32_t src_button) +{ + struct button_map_entry *map_entry; + for (size_t i = 0; i < rc.tablet.button_map_count; i++) { + map_entry = &rc.tablet.button_map[i]; + if (map_entry->from == src_button) { + return map_entry->to; + } + } + wlr_log(WLR_DEBUG, "no button map target for 0x%x", src_button); + return 0; +} diff --git a/src/input/tablet.c b/src/input/tablet.c index 0a24d619..b4a18334 100644 --- a/src/input/tablet.c +++ b/src/input/tablet.c @@ -86,20 +86,6 @@ handle_axis(struct wl_listener *listener, void *data) // Ignore other events } -uint32_t -tablet_get_mapped_button(uint32_t src_button) -{ - struct button_map_entry *map_entry; - for (size_t i = 0; i < rc.tablet.button_map_count; i++) { - map_entry = &rc.tablet.button_map[i]; - if (map_entry->from == src_button) { - return map_entry->to; - } - } - wlr_log(WLR_DEBUG, "no button map target for 0x%x", src_button); - return 0; -} - static void handle_tip(struct wl_listener *listener, void *data) { diff --git a/src/input/tablet_pad.c b/src/input/tablet_pad.c index 3c1b2a9b..29cde1e4 100644 --- a/src/input/tablet_pad.c +++ b/src/input/tablet_pad.c @@ -7,7 +7,6 @@ #include "common/mem.h" #include "config/rcxml.h" #include "input/cursor.h" -#include "input/tablet.h" #include "input/tablet_pad.h" static void