aboutsummaryrefslogtreecommitdiff
path: root/wayland.h
blob: 0c89e03b253bb4b3353e836c105ea0cf087290b7 (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
#ifndef WAYLAND_H
#define WAYLAND_H

#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-keysyms.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
#include <linux/input-event-codes.h>
#include "xdg-shell-client-protocol.h"

typedef enum {
	KEY_MOD_NONE  = 0 << 0,
	KEY_MOD_CTRL  = 1 << 0,
	KEY_MOD_ALT   = 1 << 1,
	KEY_MOD_SHIFT = 1 << 2,
	KEY_MOD_LOGO  = 1 << 3,
	KEY_MOD_ANY   = 1 << 4
} ModMask;


typedef struct {
	uint32_t k;
	uint32_t mask;
	char *s;
	/* three-valued logic variables: 0 indifferent, 1 on, -1 off */
	signed char appkey;    /* application keypad */
	signed char appcursor; /* application cursor */
} Key;


typedef struct {
	uint32_t k;
	uint32_t mask;
	void (*func)();
} Shortcut;


typedef struct {
	struct wl_display *display;
	struct wl_registry *registry;
	struct wl_shm *shm;
	struct wl_compositor *compositor;
	struct xdg_wm_base *wm_base;
	struct wl_seat *seat;
	struct {
		struct xkb_state *state;
		struct xkb_keymap *keymap;
		struct xkb_context *context;
		struct wl_keyboard *keyboard;
		struct {
			uint32_t state;
			uint32_t sym;
			uint32_t mod;
		} event;
		struct {
			int timer;
			int delay;
			int period;
		} repeat;
	} kb;
	struct {
		struct wl_pointer *pointer;
		struct wl_cursor *cursor;
		struct wl_cursor_theme *theme;
		struct wl_buffer *buffer;
		struct wl_surface *surface;
		struct wl_cursor_image *image;
		struct {
			uint32_t x;
			uint32_t y;
		} position;
		struct {
			uint32_t button;
			uint8_t click_combo;
			uint32_t tclick;
			uint32_t state;
		} buttons;
	} pointer;
	struct {
		struct wl_data_device_manager *data_device_manager;
		struct wl_data_device *data_device;
		uint32_t keyboard_enter_serial;
	} clipboard;
} Client;

int allocate_shm_file(size_t size);

#endif