2021-11-13 21:56:53 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2023-05-13 16:10:33 +03:00
|
|
|
#ifndef LABWC_MOUSEBIND_H
|
|
|
|
|
#define LABWC_MOUSEBIND_H
|
2021-08-29 14:22:49 -04:00
|
|
|
|
|
|
|
|
#include <wayland-util.h>
|
2022-02-21 03:18:38 +01:00
|
|
|
#include "ssd.h"
|
|
|
|
|
#include "config/keybind.h"
|
2021-08-29 14:22:49 -04:00
|
|
|
|
2021-09-06 21:54:00 +01:00
|
|
|
enum mouse_event {
|
|
|
|
|
MOUSE_ACTION_NONE = 0,
|
2021-08-29 14:22:49 -04:00
|
|
|
MOUSE_ACTION_DOUBLECLICK,
|
2021-11-01 20:32:14 -04:00
|
|
|
MOUSE_ACTION_CLICK,
|
|
|
|
|
MOUSE_ACTION_PRESS,
|
|
|
|
|
MOUSE_ACTION_RELEASE,
|
2022-01-06 18:30:17 -05:00
|
|
|
MOUSE_ACTION_DRAG,
|
2022-10-25 21:46:46 +02:00
|
|
|
MOUSE_ACTION_SCROLL,
|
2021-08-29 14:22:49 -04:00
|
|
|
};
|
|
|
|
|
|
2022-11-09 05:18:14 +00:00
|
|
|
enum direction {
|
|
|
|
|
LAB_DIRECTION_INVALID = 0,
|
|
|
|
|
LAB_DIRECTION_LEFT,
|
|
|
|
|
LAB_DIRECTION_RIGHT,
|
|
|
|
|
LAB_DIRECTION_UP,
|
|
|
|
|
LAB_DIRECTION_DOWN,
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-29 14:22:49 -04:00
|
|
|
struct mousebind {
|
2021-09-06 21:54:00 +01:00
|
|
|
enum ssd_part_type context;
|
2021-08-31 17:43:49 -04:00
|
|
|
|
|
|
|
|
/* ex: BTN_LEFT, BTN_RIGHT from linux/input_event_codes.h */
|
|
|
|
|
uint32_t button;
|
|
|
|
|
|
2022-11-09 05:18:14 +00:00
|
|
|
/* scroll direction; considered instead of button for scroll events */
|
|
|
|
|
enum direction direction;
|
|
|
|
|
|
2021-12-01 02:32:24 +00:00
|
|
|
/* ex: WLR_MODIFIER_SHIFT | WLR_MODIFIER_LOGO */
|
|
|
|
|
uint32_t modifiers;
|
|
|
|
|
|
2021-09-06 21:54:00 +01:00
|
|
|
/* ex: doubleclick, press, drag */
|
|
|
|
|
enum mouse_event mouse_event;
|
2022-06-10 19:42:34 +02:00
|
|
|
struct wl_list actions; /* struct action.link */
|
2021-09-06 21:54:00 +01:00
|
|
|
|
2022-06-10 19:42:34 +02:00
|
|
|
struct wl_list link; /* struct rcxml.mousebinds */
|
2021-11-01 20:32:14 -04:00
|
|
|
bool pressed_in_context; /* used in click events */
|
2021-08-29 14:22:49 -04:00
|
|
|
};
|
|
|
|
|
|
2021-09-06 21:54:00 +01:00
|
|
|
enum mouse_event mousebind_event_from_str(const char *str);
|
2021-12-01 02:32:24 +00:00
|
|
|
uint32_t mousebind_button_from_str(const char *str, uint32_t *modifiers);
|
2022-11-09 05:18:14 +00:00
|
|
|
enum direction mousebind_direction_from_str(const char *str, uint32_t *modifiers);
|
2021-09-06 21:54:00 +01:00
|
|
|
struct mousebind *mousebind_create(const char *context);
|
2023-01-29 04:06:46 +01:00
|
|
|
bool mousebind_the_same(struct mousebind *a, struct mousebind *b);
|
2021-08-29 14:22:49 -04:00
|
|
|
|
2023-05-13 16:10:33 +03:00
|
|
|
#endif /* LABWC_MOUSEBIND_H */
|