diff options
Diffstat (limited to 'include/swaybar')
-rw-r--r-- | include/swaybar/bar.h | 38 | ||||
-rw-r--r-- | include/swaybar/i3bar.h | 4 | ||||
-rw-r--r-- | include/swaybar/input.h | 49 |
3 files changed, 51 insertions, 40 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 58e2dee6..95b20510 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _SWAYBAR_BAR_H | 1 | #ifndef _SWAYBAR_BAR_H |
2 | #define _SWAYBAR_BAR_H | 2 | #define _SWAYBAR_BAR_H |
3 | #include <wayland-client.h> | 3 | #include <wayland-client.h> |
4 | #include "input.h" | ||
4 | #include "pool-buffer.h" | 5 | #include "pool-buffer.h" |
5 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 6 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
6 | #include "xdg-output-unstable-v1-client-protocol.h" | 7 | #include "xdg-output-unstable-v1-client-protocol.h" |
@@ -10,42 +11,6 @@ struct swaybar_output; | |||
10 | struct swaybar_workspace; | 11 | struct swaybar_workspace; |
11 | struct loop; | 12 | struct loop; |
12 | 13 | ||
13 | struct swaybar_pointer { | ||
14 | struct wl_pointer *pointer; | ||
15 | struct wl_cursor_theme *cursor_theme; | ||
16 | struct wl_cursor_image *cursor_image; | ||
17 | struct wl_surface *cursor_surface; | ||
18 | struct swaybar_output *current; | ||
19 | int x, y; | ||
20 | }; | ||
21 | |||
22 | enum x11_button { | ||
23 | NONE, | ||
24 | LEFT, | ||
25 | MIDDLE, | ||
26 | RIGHT, | ||
27 | SCROLL_UP, | ||
28 | SCROLL_DOWN, | ||
29 | SCROLL_LEFT, | ||
30 | SCROLL_RIGHT, | ||
31 | BACK, | ||
32 | FORWARD, | ||
33 | }; | ||
34 | |||
35 | enum hotspot_event_handling { | ||
36 | HOTSPOT_IGNORE, | ||
37 | HOTSPOT_PROCESS, | ||
38 | }; | ||
39 | |||
40 | struct swaybar_hotspot { | ||
41 | struct wl_list link; // swaybar_output::hotspots | ||
42 | int x, y, width, height; | ||
43 | enum hotspot_event_handling (*callback)(struct swaybar_output *output, | ||
44 | int x, int y, enum x11_button button, void *data); | ||
45 | void (*destroy)(void *data); | ||
46 | void *data; | ||
47 | }; | ||
48 | |||
49 | struct swaybar { | 14 | struct swaybar { |
50 | char *id; | 15 | char *id; |
51 | char *mode; | 16 | char *mode; |
@@ -125,7 +90,6 @@ void bar_teardown(struct swaybar *bar); | |||
125 | * Returns true if the bar is now visible, otherwise false. | 90 | * Returns true if the bar is now visible, otherwise false. |
126 | */ | 91 | */ |
127 | bool determine_bar_visibility(struct swaybar *bar, bool moving_layer); | 92 | bool determine_bar_visibility(struct swaybar *bar, bool moving_layer); |
128 | void free_hotspots(struct wl_list *list); | ||
129 | void free_workspaces(struct wl_list *list); | 93 | void free_workspaces(struct wl_list *list); |
130 | 94 | ||
131 | #endif | 95 | #endif |
diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h index d4a48e07..3f1ecc25 100644 --- a/include/swaybar/i3bar.h +++ b/include/swaybar/i3bar.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _SWAYBAR_I3BAR_H | 1 | #ifndef _SWAYBAR_I3BAR_H |
2 | #define _SWAYBAR_I3BAR_H | 2 | #define _SWAYBAR_I3BAR_H |
3 | 3 | ||
4 | #include "bar.h" | 4 | #include "input.h" |
5 | #include "status_line.h" | 5 | #include "status_line.h" |
6 | 6 | ||
7 | struct i3bar_block { | 7 | struct i3bar_block { |
@@ -28,7 +28,5 @@ void i3bar_block_unref(struct i3bar_block *block); | |||
28 | bool i3bar_handle_readable(struct status_line *status); | 28 | bool i3bar_handle_readable(struct status_line *status); |
29 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | 29 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, |
30 | struct i3bar_block *block, int x, int y, enum x11_button button); | 30 | struct i3bar_block *block, int x, int y, enum x11_button button); |
31 | enum x11_button wl_button_to_x11_button(uint32_t button); | ||
32 | enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value); | ||
33 | 31 | ||
34 | #endif | 32 | #endif |
diff --git a/include/swaybar/input.h b/include/swaybar/input.h new file mode 100644 index 00000000..a552e7ac --- /dev/null +++ b/include/swaybar/input.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _SWAYBAR_INPUT_H | ||
2 | #define _SWAYBAR_INPUT_H | ||
3 | |||
4 | #include <wayland-client.h> | ||
5 | #include "list.h" | ||
6 | |||
7 | struct swaybar_output; | ||
8 | |||
9 | struct swaybar_pointer { | ||
10 | struct wl_pointer *pointer; | ||
11 | struct wl_cursor_theme *cursor_theme; | ||
12 | struct wl_cursor_image *cursor_image; | ||
13 | struct wl_surface *cursor_surface; | ||
14 | struct swaybar_output *current; | ||
15 | int x, y; | ||
16 | }; | ||
17 | |||
18 | enum x11_button { | ||
19 | NONE, | ||
20 | LEFT, | ||
21 | MIDDLE, | ||
22 | RIGHT, | ||
23 | SCROLL_UP, | ||
24 | SCROLL_DOWN, | ||
25 | SCROLL_LEFT, | ||
26 | SCROLL_RIGHT, | ||
27 | BACK, | ||
28 | FORWARD, | ||
29 | }; | ||
30 | |||
31 | enum hotspot_event_handling { | ||
32 | HOTSPOT_IGNORE, | ||
33 | HOTSPOT_PROCESS, | ||
34 | }; | ||
35 | |||
36 | struct swaybar_hotspot { | ||
37 | struct wl_list link; // swaybar_output::hotspots | ||
38 | int x, y, width, height; | ||
39 | enum hotspot_event_handling (*callback)(struct swaybar_output *output, | ||
40 | int x, int y, enum x11_button button, void *data); | ||
41 | void (*destroy)(void *data); | ||
42 | void *data; | ||
43 | }; | ||
44 | |||
45 | extern const struct wl_seat_listener seat_listener; | ||
46 | |||
47 | void free_hotspots(struct wl_list *list); | ||
48 | |||
49 | #endif | ||