1use core::{
2 ffi::{c_char, c_int, c_void},
3 marker::{PhantomData, PhantomPinned},
4};
5
6use wayland_headers::wayland_client::*;
7
8#[repr(C)]
9pub struct libdecor {
10 _data: (),
11 _marker: PhantomData<(*mut u8, PhantomPinned)>,
12}
13
14#[repr(C)]
15pub struct libdecor_configuration {
16 _data: (),
17 _marker: PhantomData<(*mut u8, PhantomPinned)>,
18}
19
20#[repr(C)]
21pub struct libdecor_frame {
22 _data: (),
23 _marker: PhantomData<(*mut u8, PhantomPinned)>,
24}
25
26#[derive(Clone, Copy)]
27#[repr(C)]
28pub struct libdecor_frame_interface {
29 pub configure: Option<
30 unsafe extern "C" fn(
31 frame: *mut libdecor_frame,
32 configuration: *mut libdecor_configuration,
33 user_data: *mut c_void,
34 ),
35 >,
36
37 pub close: Option<unsafe extern "C" fn(frame: *mut libdecor_frame, user_data: *mut c_void)>,
38
39 pub commit: Option<unsafe extern "C" fn(frame: *mut libdecor_frame, user_data: *mut c_void)>,
40
41 pub dismiss_popup: Option<
42 unsafe extern "C" fn(
43 frame: *mut libdecor_frame,
44 seat_name: *const c_char,
45 user_data: *mut c_void,
46 ),
47 >,
48
49 pub reserved0: Option<unsafe extern "C" fn()>,
50 pub reserved1: Option<unsafe extern "C" fn()>,
51 pub reserved2: Option<unsafe extern "C" fn()>,
52 pub reserved3: Option<unsafe extern "C" fn()>,
53 pub reserved4: Option<unsafe extern "C" fn()>,
54 pub reserved5: Option<unsafe extern "C" fn()>,
55 pub reserved6: Option<unsafe extern "C" fn()>,
56 pub reserved7: Option<unsafe extern "C" fn()>,
57 pub reserved8: Option<unsafe extern "C" fn()>,
58 pub reserved9: Option<unsafe extern "C" fn()>,
59}
60
61#[derive(Clone, Copy)]
62#[repr(C)]
63pub struct libdecor_interface {
64 pub error: Option<
65 unsafe extern "C" fn(context: *mut libdecor, error: libdecor_error, message: *const c_char),
66 >,
67
68 pub reserved0: Option<unsafe extern "C" fn()>,
69 pub reserved1: Option<unsafe extern "C" fn()>,
70 pub reserved2: Option<unsafe extern "C" fn()>,
71 pub reserved3: Option<unsafe extern "C" fn()>,
72 pub reserved4: Option<unsafe extern "C" fn()>,
73 pub reserved5: Option<unsafe extern "C" fn()>,
74 pub reserved6: Option<unsafe extern "C" fn()>,
75 pub reserved7: Option<unsafe extern "C" fn()>,
76 pub reserved8: Option<unsafe extern "C" fn()>,
77 pub reserved9: Option<unsafe extern "C" fn()>,
78}
79
80#[repr(C)]
81pub struct libdecor_state {
82 _data: (),
83 _marker: PhantomData<(*mut u8, PhantomPinned)>,
84}
85
86#[repr(C)]
87pub struct xdg_surface {
88 _data: (),
89 _marker: PhantomData<(*mut u8, PhantomPinned)>,
90}
91
92#[repr(C)]
93pub struct xdg_toplevel {
94 _data: (),
95 _marker: PhantomData<(*mut u8, PhantomPinned)>,
96}
97
98pub const LIBDECOR_ACTION_CLOSE: libdecor_capabilities = 1 << 4;
99pub const LIBDECOR_ACTION_FULLSCREEN: libdecor_capabilities = 1 << 3;
100pub const LIBDECOR_ACTION_MINIMIZE: libdecor_capabilities = 1 << 2;
101pub const LIBDECOR_ACTION_MOVE: libdecor_capabilities = 1 << 0;
102pub const LIBDECOR_ACTION_RESIZE: libdecor_capabilities = 1 << 1;
103pub const LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE: libdecor_error = 0;
104pub const LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION: libdecor_error = 1;
105pub const LIBDECOR_RESIZE_EDGE_BOTTOM: libdecor_resize_edge = 2;
106pub const LIBDECOR_RESIZE_EDGE_BOTTOM_LEFT: libdecor_resize_edge = 5;
107pub const LIBDECOR_RESIZE_EDGE_BOTTOM_RIGHT: libdecor_resize_edge = 8;
108pub const LIBDECOR_RESIZE_EDGE_LEFT: libdecor_resize_edge = 3;
109pub const LIBDECOR_RESIZE_EDGE_NONE: libdecor_resize_edge = 0;
110pub const LIBDECOR_RESIZE_EDGE_RIGHT: libdecor_resize_edge = 6;
111pub const LIBDECOR_RESIZE_EDGE_TOP: libdecor_resize_edge = 1;
112pub const LIBDECOR_RESIZE_EDGE_TOP_LEFT: libdecor_resize_edge = 4;
113pub const LIBDECOR_RESIZE_EDGE_TOP_RIGHT: libdecor_resize_edge = 7;
114pub const LIBDECOR_WINDOW_STATE_ACTIVE: libdecor_window_state = 1 << 0;
115pub const LIBDECOR_WINDOW_STATE_FULLSCREEN: libdecor_window_state = 1 << 2;
116pub const LIBDECOR_WINDOW_STATE_MAXIMIZED: libdecor_window_state = 1 << 1;
117pub const LIBDECOR_WINDOW_STATE_NONE: libdecor_window_state = 0;
118pub const LIBDECOR_WINDOW_STATE_SUSPENDED: libdecor_window_state = 1 << 7;
119pub const LIBDECOR_WINDOW_STATE_TILED_BOTTOM: libdecor_window_state = 1 << 6;
120pub const LIBDECOR_WINDOW_STATE_TILED_LEFT: libdecor_window_state = 1 << 3;
121pub const LIBDECOR_WINDOW_STATE_TILED_RIGHT: libdecor_window_state = 1 << 4;
122pub const LIBDECOR_WINDOW_STATE_TILED_TOP: libdecor_window_state = 1 << 5;
123
124unsafe extern "C" {
125 pub fn libdecor_configuration_get_content_size(
126 configuration: *mut libdecor_configuration,
127 frame: *mut libdecor_frame,
128 width: *mut c_int,
129 height: *mut c_int,
130 ) -> bool;
131
132 pub fn libdecor_configuration_get_window_state(
133 configuration: *mut libdecor_configuration,
134 window_state: *mut libdecor_window_state,
135 ) -> bool;
136
137 pub fn libdecor_decorate(
138 context: *mut libdecor,
139 surface: *mut wl_surface,
140 iface: *mut libdecor_frame_interface,
141 user_data: *mut c_void,
142 ) -> *mut libdecor_frame;
143
144 pub fn libdecor_dispatch(context: *mut libdecor, timeout: c_int) -> c_int;
145
146 pub fn libdecor_frame_close(frame: *mut libdecor_frame);
147
148 pub fn libdecor_frame_commit(
149 frame: *mut libdecor_frame,
150 state: *mut libdecor_state,
151 configuration: *mut libdecor_configuration,
152 );
153
154 pub fn libdecor_frame_get_max_content_size(
155 frame: *const libdecor_frame,
156 content_width: *mut c_int,
157 content_height: *mut c_int,
158 );
159
160 pub fn libdecor_frame_get_min_content_size(
161 frame: *const libdecor_frame,
162 content_width: *mut c_int,
163 content_height: *mut c_int,
164 );
165
166 pub fn libdecor_frame_get_title(frame: *mut libdecor_frame) -> *const c_char;
167
168 pub fn libdecor_frame_get_xdg_surface(frame: *mut libdecor_frame) -> *mut xdg_surface;
169
170 pub fn libdecor_frame_get_xdg_toplevel(frame: *mut libdecor_frame) -> *mut xdg_toplevel;
171
172 pub fn libdecor_frame_has_capability(
173 frame: *mut libdecor_frame,
174 capability: libdecor_capabilities,
175 ) -> bool;
176
177 pub fn libdecor_frame_is_floating(frame: *mut libdecor_frame) -> bool;
178
179 pub fn libdecor_frame_is_visible(frame: *mut libdecor_frame) -> bool;
180
181 pub fn libdecor_frame_map(frame: *mut libdecor_frame);
182
183 pub fn libdecor_frame_move(frame: *mut libdecor_frame, wl_seat: *mut wl_seat, serial: u32);
184
185 pub fn libdecor_frame_popup_grab(frame: *mut libdecor_frame, seat_name: *const c_char);
186
187 pub fn libdecor_frame_popup_ungrab(frame: *mut libdecor_frame, seat_name: *const c_char);
188
189 pub fn libdecor_frame_ref(frame: *mut libdecor_frame);
190
191 pub fn libdecor_frame_resize(
192 frame: *mut libdecor_frame,
193 wl_seat: *mut wl_seat,
194 serial: u32,
195 edge: libdecor_resize_edge,
196 );
197
198 pub fn libdecor_frame_set_app_id(frame: *mut libdecor_frame, app_id: *const c_char);
199
200 pub fn libdecor_frame_set_capabilities(
201 frame: *mut libdecor_frame,
202 capabilities: libdecor_capabilities,
203 );
204
205 pub fn libdecor_frame_set_fullscreen(frame: *mut libdecor_frame, output: *mut wl_output);
206
207 pub fn libdecor_frame_set_max_content_size(
208 frame: *mut libdecor_frame,
209 content_width: c_int,
210 content_height: c_int,
211 );
212
213 pub fn libdecor_frame_set_maximized(frame: *mut libdecor_frame);
214
215 pub fn libdecor_frame_set_min_content_size(
216 frame: *mut libdecor_frame,
217 content_width: c_int,
218 content_height: c_int,
219 );
220
221 pub fn libdecor_frame_set_minimized(frame: *mut libdecor_frame);
222
223 pub fn libdecor_frame_set_parent(frame: *mut libdecor_frame, parent: *mut libdecor_frame);
224
225 pub fn libdecor_frame_set_title(frame: *mut libdecor_frame, title: *const c_char);
226
227 pub fn libdecor_frame_set_visibility(frame: *mut libdecor_frame, visible: bool);
228
229 pub fn libdecor_frame_show_window_menu(
230 frame: *mut libdecor_frame,
231 wl_seat: *mut wl_seat,
232 serial: u32,
233 x: c_int,
234 y: c_int,
235 );
236
237 pub fn libdecor_frame_translate_coordinate(
238 frame: *mut libdecor_frame,
239 surface_x: c_int,
240 surface_y: c_int,
241 frame_x: *mut c_int,
242 frame_y: *mut c_int,
243 );
244
245 pub fn libdecor_frame_unref(frame: *mut libdecor_frame);
246
247 pub fn libdecor_frame_unset_capabilities(
248 frame: *mut libdecor_frame,
249 capabilities: libdecor_capabilities,
250 );
251
252 pub fn libdecor_frame_unset_fullscreen(frame: *mut libdecor_frame);
253
254 pub fn libdecor_frame_unset_maximized(frame: *mut libdecor_frame);
255
256 pub fn libdecor_get_fd(context: *mut libdecor) -> c_int;
257
258 pub fn libdecor_new(display: *mut wl_display, iface: *mut libdecor_interface) -> *mut libdecor;
259
260 pub fn libdecor_state_free(state: *mut libdecor_state);
261
262 pub fn libdecor_state_new(width: c_int, height: c_int) -> *mut libdecor_state;
263
264 pub fn libdecor_unref(context: *mut libdecor);
265}
266
267pub type libdecor_capabilities = c_int;
268pub type libdecor_error = c_int;
269pub type libdecor_resize_edge = c_int;
270pub type libdecor_window_state = c_int;