summaryrefslogtreecommitdiffstats
path: root/include/wayland.h
blob: d7c7397d0ea40571e5f68c8a2b2440d828ff9d63 (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
#ifndef ROFI_XCB_H
#define ROFI_XCB_H

#include <glib.h>
#include <cairo.h>
#include <xkbcommon/xkbcommon.h>
#include <wayland-client.h>
#include <libgwater-wayland.h>

#include "unstable/window-switcher/window-switcher-unstable-v1-client-protocol.h"
#include "xkb.h"

typedef enum {
    WAYLAND_GLOBAL_COMPOSITOR,
    WAYLAND_GLOBAL_LAUNCHER_MENU,
    WAYLAND_GLOBAL_WINDOW_SWITCHER,
    WAYLAND_GLOBAL_SHM,
    _WAYLAND_GLOBAL_SIZE,
} wayland_global_name;

typedef struct _wayland_seat wayland_seat;

typedef struct {
    GMainLoop       *main_loop;
    GWaterWaylandSource *main_loop_source;
    struct wl_display *display;
    struct wl_registry *registry;
    uint32_t global_names[_WAYLAND_GLOBAL_SIZE];
    struct wl_compositor *compositor;
    struct zww_launcher_menu_v1 *launcher_menu;
    struct zww_window_switcher_v1 *window_switcher;
    struct wl_shm *shm;
    size_t buffer_count;
    struct {
        char *theme_name;
        char **name;
        struct wl_cursor_theme *theme;
        struct wl_cursor *cursor;
        struct wl_cursor_image *image;
        struct wl_surface *surface;
        struct wl_callback *frame_cb;
    } cursor;
    GHashTable *seats;
    GHashTable *seats_by_name;
    wayland_seat *last_seat;
    GHashTable *outputs;
    struct wl_surface *surface;
    struct wl_callback *frame_cb;
    size_t scales[3];
    int32_t scale;
} wayland_stuff;

struct _wayland_seat {
    wayland_stuff *context;
    uint32_t global_name;
    struct wl_seat *seat;
    gchar *name;
    uint32_t serial;
    struct wl_keyboard *keyboard;
    xkb_stuff xkb;
    struct wl_pointer *pointer;
    widget_button_event button;
    widget_motion_event motion;
    struct {
        gint vertical;
        gint horizontal;
    } wheel;
};

/* Supported interface versions */
#define WL_COMPOSITOR_INTERFACE_VERSION 3
#define WW_LAUNCHER_MENU_INTERFACE_VERSION 1
#define WW_WINDOW_SWITCHER_INTERFACE_VERSION 1
#define WL_SHM_INTERFACE_VERSION 1
#define WL_SEAT_INTERFACE_VERSION 5
#define WL_OUTPUT_INTERFACE_VERSION 2

extern wayland_stuff *wayland;

#endif