summaryrefslogtreecommitdiffstats
path: root/source/platform/platform_include.h
blob: f2ce09ed874c42f8b605af22b4b25f10e7ec4f30 (plain) (blame)
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
#ifndef PLATFORM_INCLUDE_H
#define PLATFORM_INCLUDE_H

// NOTE: window and input. sits on top of base + core, the renderer only sees the native
// handles (wl_display / wl_surface, HINSTANCE / HWND) through PlatformWindowNativeHandles.

#ifndef WAYLAND
#define WAYLAND 0
#endif

#if PLATFORM_LINUX

#include <linux/input-event-codes.h>
#include <poll.h>
#include <sys/wait.h>
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-keysyms.h>
// NOTE: xlib / xkb have struct members called `internal`, which base #defines to static
#pragma push_macro("internal")
#undef internal
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/XKBlib.h>
#include <X11/keysym.h>
#pragma pop_macro("internal")

// NOTE: generated by wayland-scanner in compile.sh, the glue .c files are linked separately
#include "xdg-shell-client.h"
// NOTE: get_layer_surface has a parameter called `namespace`, a c++ keyword
#define namespace layer_namespace
#include "wlr-layer-shell-unstable-v1-client.h"
#undef namespace
#include "cursor-shape-v1-client.h"
#include "xdg-decoration-unstable-v1-client.h"

#include "platform.h"
#include "platform_linux_wayland.h"
#include "platform_linux_x11.h"
#include "platform_linux.h"
#include "platform_linux.cpp"
#include "platform_linux_wayland.cpp"
#include "platform_linux_x11.cpp"

#elif PLATFORM_WINDOWS

#include <windowsx.h>
#include "platform_keysyms.h"

#include "platform.h"
#include "platform_win32.h"
#include "platform_win32.cpp"

#elif PLATFORM_APPLE

#include "platform_keysyms.h"
#include "platform.h"
#include "platform_macos.h"
// NOTE: the implementation is platform_macos.mm, its own objective-c++ translation unit

#else
#error unsupported platform
#endif

#endif // PLATFORM_INCLUDE_H