1 #pragma once
2 
3 /**
4  * This file is used to put all wlroots headers needed in the Wayfire
5  * (not only API) in an extern "C" block because wlroots headers are not
6  * always compatible with C++.
7  *
8  * Note that some wlroots headers require generated protocol header files.
9  * There are disabled unless the protocol header file is present.
10  */
11 #include <wayfire/nonstd/wlroots.hpp>
12 
13 // WF_USE_CONFIG_H is set only when building Wayfire itself, external plugins
14 // need to use <wayfire/config.h>
15 #ifdef WF_USE_CONFIG_H
16     #include <config.h>
17 #else
18     #include <wayfire/config.h>
19 #endif
20 
21 extern "C"
22 {
23 // Rendering
24 #define static
25 #include <wlr/types/wlr_compositor.h>
26 #include <wlr/render/wlr_renderer.h>
27 #include <wlr/render/gles2.h>
28 #include <wlr/render/egl.h>
29 #include <wlr/types/wlr_matrix.h>
30 #undef static
31 #include <wlr/types/wlr_buffer.h>
32 #include <wlr/types/wlr_viewporter.h>
33 
34 #include <wlr/types/wlr_output_damage.h>
35 #include <wlr/types/wlr_presentation_time.h>
36 #include <wlr/util/region.h>
37 #include <wlr/types/wlr_screencopy_v1.h>
38 #include <wlr/types/wlr_export_dmabuf_v1.h>
39 
40 // Shells
41 #if  __has_include(<xdg-shell-protocol.h>)
42     #include <wlr/types/wlr_xdg_shell.h>
43     #include <wlr/types/wlr_xdg_decoration_v1.h>
44 #endif
45 #include <wlr/types/wlr_surface.h>
46 
47 #include <wlr/types/wlr_foreign_toplevel_management_v1.h>
48 #include <wlr/types/wlr_server_decoration.h>
49 
50 // layer-shell needs the protocol file, so we cannot expose it here
51 #if  __has_include(<wlr-layer-shell-unstable-v1-protocol.h>)
52     #define namespace namespace_t
53     #include <wlr/types/wlr_layer_shell_v1.h>
54     #undef namespace
55 #endif
56 
57 #if WF_HAS_XWAYLAND
58     // We need to rename class to class_t for the xwayland definitions.
59     // However, it indirectly includes pthread.h which uses 'class' in the
60     // C++ meaning, so we should include pthread before overriding 'class'.
61     #if __has_include(<pthread.h>)
62         #include <pthread.h>
63     #endif
64 
65     #define class class_t
66     #define static
67     #include <wlr/xwayland.h>
68     #undef static
69     #undef class
70 #endif
71 
72 // Backends
73 #include <wlr/config.h>
74 #define static
75 #include <wlr/backend.h>
76 #include <wlr/backend/drm.h>
77 #if WLR_HAS_X11_BACKEND
78     #include <wlr/backend/x11.h>
79 #endif
80 #include <wlr/backend/noop.h>
81 #include <wlr/backend/wayland.h>
82 #undef static
83 #include <wlr/backend/libinput.h>
84 #include <wlr/backend/session.h>
85 #include <wlr/util/log.h>
86 
87 // Output management
88 #include <wlr/types/wlr_output_layout.h>
89 #include <wlr/types/wlr_output_management_v1.h>
90 
91 #if __has_include(<wlr-output-power-management-unstable-v1-protocol.h>)
92     #include <wlr/types/wlr_output_power_management_v1.h>
93 #endif
94 #include <wlr/types/wlr_gamma_control_v1.h>
95 #include <wlr/types/wlr_xdg_output_v1.h>
96 
97 // Input
98 #include <wlr/types/wlr_seat.h>
99 #if __has_include(<pointer-constraints-unstable-v1-protocol.h>)
100     #include <wlr/types/wlr_pointer_constraints_v1.h>
101 #endif
102 #include <wlr/types/wlr_cursor.h>
103 #if __has_include(<tablet-unstable-v2-protocol.h>)
104     #include <wlr/types/wlr_tablet_v2.h>
105 #endif
106 #include <wlr/types/wlr_tablet_tool.h>
107 #include <wlr/types/wlr_tablet_pad.h>
108 #include <wlr/types/wlr_data_device.h>
109 #include <wlr/types/wlr_primary_selection.h>
110 #include <wlr/types/wlr_switch.h>
111 #include <wlr/types/wlr_xcursor_manager.h>
112 #include <wlr/types/wlr_pointer_gestures_v1.h>
113 #include <wlr/types/wlr_idle.h>
114 #include <wlr/interfaces/wlr_keyboard.h>
115 #include <wlr/xcursor.h>
116 #include <wlr/types/wlr_data_control_v1.h>
117 #include <wlr/types/wlr_virtual_keyboard_v1.h>
118 #include <wlr/types/wlr_virtual_pointer_v1.h>
119 #include <wlr/types/wlr_idle_inhibit_v1.h>
120 #include <wlr/types/wlr_input_inhibitor.h>
121 #define delete delete_
122 #include <wlr/types/wlr_input_method_v2.h>
123 #undef delete
124 #include <wlr/types/wlr_relative_pointer_v1.h>
125 #include <wlr/types/wlr_text_input_v3.h>
126 #include <wlr/types/wlr_gtk_primary_selection.h>
127 #include <wlr/types/wlr_primary_selection_v1.h>
128 }
129