sway/include/swaybar/input.h
Brian Ashworth 02bbefda20 bar_cmd_tray_bind: Use mouse button helpers
This modifies `bar_cmd_tray_bindsym` to use `get_mouse_bindsym` for
parsing mouse buttons. This also introduces `bar_cmd_tray_bindcode`,
which will use `get_mouse_bindcode` for parsing mouse buttons. Like with
sway bindings, the two commands are encapsulated in a single file to
maximize shared code.

This also modifies tray bindings to work off of events codes rather than
x11 buttons, which allows for any mouse buttons to be used.

For `get_bar_config`, `event_code` has been added to the `tray_bindings`
section and will include to event code for the button. If the event code
can be mapped to a x11 button, `input_code` will still be the x11 button
number. Otherwise, `input_code` will be `0`.
2019-01-16 11:12:45 +01:00

49 lines
1.1 KiB
C

#ifndef _SWAYBAR_INPUT_H
#define _SWAYBAR_INPUT_H
#include <wayland-client.h>
#include "list.h"
#define SWAY_SCROLL_UP KEY_MAX + 1
#define SWAY_SCROLL_DOWN KEY_MAX + 2
#define SWAY_SCROLL_LEFT KEY_MAX + 3
#define SWAY_SCROLL_RIGHT KEY_MAX + 4
struct swaybar;
struct swaybar_output;
struct swaybar_pointer {
struct wl_pointer *pointer;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor_image *cursor_image;
struct wl_surface *cursor_surface;
struct swaybar_output *current;
int x, y;
uint32_t serial;
};
enum hotspot_event_handling {
HOTSPOT_IGNORE,
HOTSPOT_PROCESS,
};
struct swaybar_hotspot {
struct wl_list link; // swaybar_output::hotspots
int x, y, width, height;
enum hotspot_event_handling (*callback)(struct swaybar_output *output,
struct swaybar_hotspot *hotspot, int x, int y, uint32_t button,
void *data);
void (*destroy)(void *data);
void *data;
};
extern const struct wl_seat_listener seat_listener;
void update_cursor(struct swaybar *bar);
uint32_t event_to_x11_button(uint32_t event);
void free_hotspots(struct wl_list *list);
#endif