diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/backend/libinput.h | 9 | ||||
-rw-r--r-- | include/common/log.h | 5 | ||||
-rw-r--r-- | include/types.h | 9 | ||||
-rw-r--r-- | include/wlr/types.h | 62 |
4 files changed, 81 insertions, 4 deletions
diff --git a/include/backend/libinput.h b/include/backend/libinput.h index 80f57177..89286ab8 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -68,4 +68,13 @@ void handle_tablet_tool_tip(struct libinput_event *event, void handle_tablet_tool_button(struct libinput_event *event, struct libinput_device *device); +struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( + struct libinput_device *device); +void handle_tablet_pad_button(struct libinput_event *event, + struct libinput_device *device); +void handle_tablet_pad_ring(struct libinput_event *event, + struct libinput_device *device); +void handle_tablet_pad_strip(struct libinput_event *event, + struct libinput_device *device); + #endif diff --git a/include/common/log.h b/include/common/log.h index 3fca0dcf..98e57900 100644 --- a/include/common/log.h +++ b/include/common/log.h @@ -13,12 +13,13 @@ void _wlr_log(log_importance_t verbosity, const char *format, ...) ATTRIB_PRINTF(2, 3); void _wlr_vlog(log_importance_t verbosity, const char *format, va_list args) ATTRIB_PRINTF(2, 0); +const char *_strip_path(const char *filepath); #define wlr_log(verb, fmt, ...) \ - _wlr_log(verb, "[%s:%d] " fmt, __FILE__ + strlen(WLR_SRC_DIR) + 1, __LINE__, ##__VA_ARGS__) + _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__) #define wlr_vlog(verb, fmt, args) \ - _wlr_vlog(verb, "[%s:%d] " fmt, __FILE__ + strlen(WLR_SRC_DIR) + 1, __LINE__, args) + _wlr_vlog(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, args) #define wlr_log_errno(verb, fmt, ...) \ wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno)) diff --git a/include/types.h b/include/types.h index e2930a9f..54aa5606 100644 --- a/include/types.h +++ b/include/types.h @@ -23,6 +23,7 @@ void wlr_output_free(struct wlr_output *output); struct wlr_keyboard_impl { void (*destroy)(struct wlr_keyboard_state *state); + void (*led_update)(struct wlr_keyboard_state *state, uint32_t leds); }; struct wlr_keyboard *wlr_keyboard_create(struct wlr_keyboard_impl *impl, @@ -53,6 +54,14 @@ struct wlr_tablet_tool *wlr_tablet_tool_create(struct wlr_tablet_tool_impl *impl struct wlr_tablet_tool_state *state); void wlr_tablet_tool_destroy(struct wlr_tablet_tool *tool); +struct wlr_tablet_pad_impl { + void (*destroy)(struct wlr_tablet_pad_state *pad); +}; + +struct wlr_tablet_pad *wlr_tablet_pad_create(struct wlr_tablet_pad_impl *impl, + struct wlr_tablet_pad_state *state); +void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad); + struct wlr_input_device_impl { void (*destroy)(struct wlr_input_device_state *state); }; diff --git a/include/wlr/types.h b/include/wlr/types.h index 3afc361e..1d2abab5 100644 --- a/include/wlr/types.h +++ b/include/wlr/types.h @@ -53,18 +53,28 @@ void wlr_output_destroy(struct wlr_output *output); void wlr_output_effective_resolution(struct wlr_output *output, int *width, int *height); +enum WLR_KEYBOARD_LED { + WLR_LED_NUM_LOCK = 1, + WLR_LED_CAPS_LOCK = 2, + WLR_LED_SCROLL_LOCK = 4, + WLR_LED_LAST +}; + struct wlr_keyboard_state; struct wlr_keyboard_impl; struct wlr_keyboard { struct wlr_keyboard_state *state; struct wlr_keyboard_impl *impl; + uint32_t leds; struct { struct wl_signal key; } events; }; +void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds); + enum wlr_key_state { WLR_KEY_RELEASED, WLR_KEY_PRESSED, @@ -254,8 +264,55 @@ struct wlr_tablet_tool_button { enum wlr_button_state state; }; -// TODO: tablet pad -// TODO: switch +// NOTE: the wlr tablet pad implementation does not currently support tablets +// with more than one mode. I don't own any such hardware so I cannot test it +// and it is too complicated to make a meaningful implementation of blindly. +struct wlr_tablet_pad_impl; +struct wlr_tablet_pad_state; + +struct wlr_tablet_pad { + struct wlr_tablet_pad_impl *impl; + struct wlr_tablet_pad_state *state; + + struct { + struct wl_signal button; + struct wl_signal ring; + struct wl_signal strip; + } events; +}; + +struct wlr_tablet_pad_button { + uint32_t time_sec; + uint64_t time_usec; + uint32_t button; + enum wlr_button_state state; +}; + +enum wlr_tablet_pad_ring_source { + WLR_TABLET_PAD_RING_SOURCE_UNKNOWN, + WLR_TABLET_PAD_RING_SOURCE_FINGER, +}; + +struct wlr_tablet_pad_ring { + uint32_t time_sec; + uint64_t time_usec; + enum wlr_tablet_pad_ring_source source; + uint32_t ring; + double position; +}; + +enum wlr_tablet_pad_strip_source { + WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN, + WLR_TABLET_PAD_STRIP_SOURCE_FINGER, +}; + +struct wlr_tablet_pad_strip { + uint32_t time_sec; + uint64_t time_usec; + enum wlr_tablet_pad_strip_source source; + uint32_t strip; + double position; +}; enum wlr_input_device_type { WLR_INPUT_DEVICE_KEYBOARD, @@ -284,6 +341,7 @@ struct wlr_input_device { struct wlr_pointer *pointer; struct wlr_touch *touch; struct wlr_tablet_tool *tablet_tool; + struct wlr_tablet_pad *tablet_pad; }; }; |