use ::{
bitflags::bitflags,
std::{
ffi::c_void,
mem,
os::raw::{c_char, c_double, c_int, c_uint},
},
};
#[allow(clippy::manual_non_exhaustive)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum PropertyType {
Integer,
Double,
String,
Char,
Boolean,
Color,
Image,
Padding,
Link,
Position,
Highlight,
List,
Orientation,
Cursor,
Inherit,
#[doc(hidden)]
#[non_exhaustive]
__Count,
}
extern "C" {
pub static ProtypeTypeName: [*const c_char; PropertyType::__Count as usize];
}
bitflags! {
#[repr(transparent)]
pub struct RofiHighlightStyle: c_uint {
const BOLD = 1;
const UNDERLINE = 2;
const STRIKETHROUGH = 16;
const SMALL_CAPS = 32;
const ITALIC = 4;
const COLOR = 8;
}
}
const _: [(); mem::size_of::<RofiHighlightStyle>()] = [(); mem::size_of::<PropertyType>()];
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiLineStyle {
Solid,
Dash,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiPixelUnit {
Px,
Mm,
Em,
Percent,
Ch,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiDistanceModifier {
None,
Add,
Subtract,
Divide,
Multiply,
Modulo,
Group,
Min,
Max,
Round,
Floor,
Ceil,
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(C)]
pub struct RofiDistanceUnit {
pub distance: c_double,
pub unit_type: RofiPixelUnit,
pub mod_type: RofiDistanceModifier,
pub left: *mut RofiDistanceUnit,
pub right: *mut RofiDistanceUnit,
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(C)]
pub struct RofiDistance {
pub base: RofiDistanceUnit,
pub style: RofiLineStyle,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiOrientation {
Vertical,
Horizontal,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiCursorType {
Default,
Pointer,
Text,
}
impl Default for RofiCursorType {
fn default() -> Self {
Self::Default
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(C)]
pub struct ThemeColor {
pub red: f64,
pub green: f64,
pub blue: f64,
pub alpha: f64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiImageType {
Url,
LinearGradient,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiDirection {
Left,
Right,
Top,
Bottom,
Angle,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(C)]
pub enum RofiScaleType {
None,
Both,
Height,
Width,
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(C)]
pub struct RofiImage {
pub image_type: RofiImageType,
pub url: *const c_char,
pub scaling: RofiScaleType,
pub wsize: c_int,
pub hsize: c_int,
pub dir: RofiDirection,
pub angle: f64,
pub colors: *const glib_sys::GList,
pub surface_id: u32,
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(C)]
pub struct RofiPadding {
pub top: RofiDistance,
pub right: RofiDistance,
pub bottom: RofiDistance,
pub left: RofiDistance,
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(C)]
pub struct RofiHighlightColorStyle {
pub style: RofiHighlightStyle,
pub color: ThemeColor,
}
bitflags! {
#[repr(transparent)]
pub struct WindowLocation: c_uint {
const CENTER = 0;
const NORTH = 1;
const EAST = 2;
const SOUTH = 4;
const WEST = 8;
const NORTH_WEST = Self::NORTH.bits | Self::WEST.bits;
const NORTH_EAST = Self::NORTH.bits | Self::EAST.bits;
const SOUTH_EAST = Self::SOUTH.bits | Self::EAST.bits;
const SOUTH_WEST = Self::SOUTH.bits | Self::WEST.bits;
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(C)]
pub struct PropertyLink {
pub name: *mut c_char,
pub property_ref: *mut Property,
pub def_value: *mut Property,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub union PropertyValue {
pub i: i32,
pub f: f64,
pub s: *mut c_char,
pub c: c_char,
pub b: glib_sys::gboolean,
pub color: ThemeColor,
pub padding: RofiPadding,
pub link: PropertyLink,
pub highlight: RofiHighlightColorStyle,
pub image: RofiImage,
pub list: *mut glib_sys::GList,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct Property {
pub name: *const c_char,
pub ty: PropertyType,
pub value: PropertyValue,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(C)]
pub struct RofiRangePair {
pub start: c_int,
pub stop: c_int,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(C)]
pub struct RofiIntMatcher {
pub regex: *mut glib_sys::GRegex,
pub invert: glib_sys::gboolean,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(C)]
pub struct ThreadState {
pub callback: Option<unsafe extern "C" fn(t: *mut ThreadState, data: *mut c_void)>,
}
extern "C" {
pub static mut tpool: *mut glib_sys::GThreadPool;
}