1use ::{
4 bitflags::bitflags,
5 std::{
6 ffi::c_void,
7 mem,
8 os::raw::{c_char, c_double, c_int, c_uint},
9 },
10};
11
12#[allow(clippy::manual_non_exhaustive)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
15#[repr(C)]
16pub enum PropertyType {
17 Integer,
18 Double,
19 String,
20 Char,
21 Boolean,
22 Color,
23 Image,
24 Padding,
25 Link,
26 Position,
27 Highlight,
28 List,
29 Orientation,
30 Cursor,
31 Inherit,
32 #[doc(hidden)]
33 #[non_exhaustive]
34 __Count,
35}
36
37extern "C" {
38 pub static ProtypeTypeName: [*const c_char; PropertyType::__Count as usize];
40}
41
42bitflags! {
43 #[repr(transparent)]
45 #[derive(Clone, Copy, Debug, PartialEq)]
46 pub struct RofiHighlightStyle: c_uint {
47 const BOLD = 1;
48 const UNDERLINE = 2;
49 const STRIKETHROUGH = 16;
50 const ITALIC = 4;
51 const COLOR = 8;
52 const UPPERCASE = 32;
53 const LOWERCASE = 64;
54 const CAPITALIZE = 128;
55 }
56}
57
58const _: [(); mem::size_of::<RofiHighlightStyle>()] = [(); mem::size_of::<PropertyType>()];
60
61#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
63#[repr(C)]
64pub enum RofiLineStyle {
65 Solid,
67 Dash,
69}
70
71#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
73#[repr(C)]
74pub enum RofiPixelUnit {
75 Px,
77 Mm,
79 Em,
81 Percent,
83 Ch,
85}
86
87#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
88#[repr(C)]
89pub enum RofiDistanceModifier {
90 None,
91 Add,
92 Subtract,
93 Divide,
94 Multiply,
95 Modulo,
96 Group,
97 Min,
98 Max,
99 Round,
100 Floor,
101 Ceil,
102}
103
104#[derive(Debug, Clone, Copy, PartialEq)]
105#[repr(C)]
106pub struct RofiDistanceUnit {
107 pub distance: c_double,
109 pub unit_type: RofiPixelUnit,
111
112 pub mod_type: RofiDistanceModifier,
114
115 pub left: *mut RofiDistanceUnit,
117
118 pub right: *mut RofiDistanceUnit,
120}
121
122#[derive(Debug, Clone, Copy, PartialEq)]
123#[repr(C)]
124pub struct RofiDistance {
125 pub base: RofiDistanceUnit,
127 pub style: RofiLineStyle,
129}
130
131#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
133#[repr(C)]
134pub enum RofiOrientation {
135 Vertical,
136 Horizontal,
137}
138
139#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
141#[repr(C)]
142pub enum RofiCursorType {
143 Default,
144 Pointer,
145 Text,
146}
147
148impl Default for RofiCursorType {
149 fn default() -> Self {
150 Self::Default
151 }
152}
153
154#[derive(Debug, Clone, Copy, PartialEq)]
156#[repr(C)]
157pub struct ThemeColor {
158 pub red: f64,
160 pub green: f64,
162 pub blue: f64,
164 pub alpha: f64,
166}
167
168#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
170#[repr(C)]
171pub enum RofiImageType {
172 Url,
173 LinearGradient,
174}
175
176#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
177#[repr(C)]
178pub enum RofiDirection {
179 Left,
180 Right,
181 Top,
182 Bottom,
183 Angle,
184}
185
186#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
187#[repr(C)]
188pub enum RofiScaleType {
189 None,
190 Both,
191 Height,
192 Width,
193}
194
195#[derive(Debug, Clone, Copy, PartialEq)]
196#[repr(C)]
197pub struct RofiImage {
198 pub image_type: RofiImageType,
199 pub url: *const c_char,
200 pub scaling: RofiScaleType,
201 pub wsize: c_int,
202 pub hsize: c_int,
203
204 pub dir: RofiDirection,
205 pub angle: f64,
206 pub colors: *const glib_sys::GList,
208
209 pub surface_id: u32,
211}
212
213#[derive(Debug, Clone, Copy, PartialEq)]
214#[repr(C)]
215pub struct RofiPadding {
216 pub top: RofiDistance,
217 pub right: RofiDistance,
218 pub bottom: RofiDistance,
219 pub left: RofiDistance,
220}
221
222#[derive(Debug, Clone, Copy, PartialEq)]
224#[repr(C)]
225pub struct RofiHighlightColorStyle {
226 pub style: RofiHighlightStyle,
228 pub color: ThemeColor,
229}
230
231bitflags! {
232 #[repr(transparent)]
240 pub struct WindowLocation: c_uint {
241 const CENTER = 0;
242 const NORTH = 1;
244 const EAST = 2;
246 const SOUTH = 4;
248 const WEST = 8;
250 const NORTH_WEST = Self::NORTH.bits() | Self::WEST.bits();
252 const NORTH_EAST = Self::NORTH.bits() | Self::EAST.bits();
254 const SOUTH_EAST = Self::SOUTH.bits() | Self::EAST.bits();
256 const SOUTH_WEST = Self::SOUTH.bits() | Self::WEST.bits();
258 }
259}
260
261#[derive(Debug, Clone, Copy, PartialEq, Eq)]
262#[repr(C)]
263pub struct PropertyLink {
264 pub name: *mut c_char,
266 pub property_ref: *mut Property,
268 pub def_value: *mut Property,
270}
271
272#[derive(Clone, Copy)]
273#[repr(C)]
274pub union PropertyValue {
275 pub i: i32,
277 pub f: f64,
279 pub s: *mut c_char,
281 pub c: c_char,
283 pub b: glib_sys::gboolean,
285 pub color: ThemeColor,
287 pub padding: RofiPadding,
289 pub link: PropertyLink,
291 pub highlight: RofiHighlightColorStyle,
293 pub image: RofiImage,
295 pub list: *mut glib_sys::GList,
297}
298
299#[derive(Clone, Copy)]
301#[repr(C)]
302pub struct Property {
303 pub name: *const c_char,
305 pub ty: PropertyType,
307 pub value: PropertyValue,
309}
310
311#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
313#[repr(C)]
314pub enum ThemeMediaType {
315 MinWidth,
317 MaxWidth,
319 MinHeight,
321 MaxHeight,
323 MonId,
325 MinAspectRatio,
327 MaxAspectRatio,
329 Boolean,
331 Invalid,
333}
334
335#[derive(Debug, Clone, Copy, PartialEq)]
337#[repr(C)]
338pub struct ThemeMedia {
339 pub r#type: ThemeMediaType,
340 pub value: f64,
341 pub boolv: glib_sys::gboolean,
342}
343
344#[derive(Debug, Clone, Copy, PartialEq, Eq)]
346#[repr(C)]
347pub struct ThemeWidget {
348 pub set: c_int,
349 pub name: *mut c_char,
350 pub num_widgets: c_uint,
351 pub widgets: *mut *mut ThemeWidget,
352 pub media: *mut ThemeMedia,
353 pub properties: *mut glib_sys::GHashTable,
354 pub parent: *mut ThemeWidget,
355}
356
357pub type ConfigEntry = ThemeWidget;
358
359#[derive(Debug, Clone, Copy, PartialEq, Eq)]
361#[repr(C)]
362pub struct RofiRangePair {
363 pub start: c_int,
364 pub stop: c_int,
365}
366
367#[derive(Debug, Clone, Copy, PartialEq, Eq)]
369#[repr(C)]
370pub struct RofiIntMatcher {
371 pub regex: *mut glib_sys::GRegex,
372 pub invert: glib_sys::gboolean,
373}
374
375#[derive(Debug, Clone, Copy, PartialEq, Eq)]
377#[repr(C)]
378pub struct ThreadState {
379 pub callback: Option<unsafe extern "C" fn(t: *mut ThreadState, data: *mut c_void)>,
380 pub free: unsafe extern "C" fn(*mut c_void),
381 pub priority: c_int,
382}
383
384extern "C" {
385 pub static mut tpool: *mut glib_sys::GThreadPool;
386}