summaryrefslogtreecommitdiff
path: root/src/window_x11.h
blob: b4790963ada2e1800dd8123c0950e256e473b1a6 (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
#pragma once

#include <al/array.h>
#include <nnwt/socket.h>

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/Xfixes.h>
#include <X11/cursorfont.h>
#include <X11/Xcursor/Xcursor.h>
#include <X11/XKBlib.h>

#include "window.h"
#if defined STELA_API_VULKAN
#include "vk_common.h"
#elif defined STELA_API_OPENGL
#include "egl_common.h"
#endif

#define STELA_WAYLAND_KEY_MAX (KEY_MEDIA + 1)

struct stl_x11_global {
    Display *x11_d;
    XkbDescPtr xkb_desc;
    Cursor cursors[STELA_CURSOR_HIDDEN];
    array(struct stl_monitor *) monitors;
#if defined STELA_API_VULKAN
    const char **vk_extensions;
#elif defined STELA_API_OPENGL
    struct stl_egl_global egl;
#endif
    void (*output_discovered)(void *, struct stl_monitor *);
    void *userdata;
};

struct stl_window_x11 {
    struct stl_window w;
    Window window;
    bool cursor_hidden;
#if defined STELA_API_OPENGL
    struct stl_egl egl;
#endif
#ifdef STELA_PAUSE
    struct nn_pollfd fds[2];
#else
    struct nn_pollfd fds[1];
#endif
};