blob: 6a56f14f31959dfcc33bc5f8a93a8e2972454be0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#ifndef _SWAYNAG_SWAYNAG_H
#define _SWAYNAG_SWAYNAG_H
#include <stdint.h>
#include <strings.h>
#include "list.h"
#include "pool-buffer.h"
#include "swaynag/types.h"
#include "xdg-output-unstable-v1-client-protocol.h"
#define SWAYNAG_BAR_BORDER_THICKNESS 2
#define SWAYNAG_MESSAGE_PADDING 8
#define SWAYNAG_DETAILS_BORDER_THICKNESS 3
#define SWAYNAG_BUTTON_BORDER_THICKNESS 3
#define SWAYNAG_BUTTON_GAP 20
#define SWAYNAG_BUTTON_GAP_CLOSE 15
#define SWAYNAG_BUTTON_MARGIN_RIGHT 2
#define SWAYNAG_BUTTON_PADDING 3
#define SWAYNAG_MAX_HEIGHT 500
enum swaynag_action_type {
SWAYNAG_ACTION_DISMISS,
SWAYNAG_ACTION_EXPAND,
SWAYNAG_ACTION_COMMAND,
};
struct swaynag_pointer {
struct wl_pointer *pointer;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor_image *cursor_image;
struct wl_surface *cursor_surface;
int x;
int y;
};
struct swaynag_output {
char *name;
struct wl_output *wl_output;
uint32_t wl_name;
};
struct swaynag_button {
char *text;
enum swaynag_action_type type;
char *action;
int x;
int y;
int width;
int height;
};
struct swaynag_details {
bool visible;
char *message;
int x;
int y;
int width;
int height;
int offset;
int visible_lines;
int total_lines;
struct swaynag_button button_details;
struct swaynag_button button_up;
struct swaynag_button button_down;
};
struct swaynag {
bool run_display;
int querying_outputs;
struct wl_display *display;
struct wl_compositor *compositor;
struct wl_seat *seat;
struct wl_shm *shm;
struct swaynag_pointer pointer;
struct zxdg_output_manager_v1 *xdg_output_manager;
struct swaynag_output output;
struct zwlr_layer_shell_v1 *layer_shell;
struct zwlr_layer_surface_v1 *layer_surface;
struct wl_surface *surface;
uint32_t width;
uint32_t height;
int32_t scale;
struct pool_buffer buffers[2];
struct pool_buffer *current_buffer;
struct swaynag_type *type;
uint32_t anchors;
char *message;
char *font;
list_t *buttons;
struct swaynag_details details;
};
void swaynag_setup(struct swaynag *swaynag);
void swaynag_run(struct swaynag *swaynag);
void swaynag_destroy(struct swaynag *swaynag);
#endif
|