1// x11-rs: Rust bindings for X11 libraries
2// The X11 libraries are available under the MIT license.
3// These bindings are public domain.
4
5use libc::FILE;
6use std::os::raw::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void};
7
8use crate::xlib::{Cursor, Display, XColor, XImage};
9
10//
11// functions
12//
13
14x11_link! { Xcursor, xcursor, ["libXcursor.so.1", "libXcursor.so"], 59,
15 pub fn XcursorAnimateCreate (_1: *mut XcursorCursors) -> *mut XcursorAnimate,
16 pub fn XcursorAnimateDestroy (_1: *mut XcursorAnimate) -> (),
17 pub fn XcursorAnimateNext (_1: *mut XcursorAnimate) -> c_ulong,
18 pub fn XcursorCommentCreate (_2: c_uint, _1: c_int) -> *mut XcursorComment,
19 pub fn XcursorCommentDestroy (_1: *mut XcursorComment) -> (),
20 pub fn XcursorCommentsCreate (_1: c_int) -> *mut XcursorComments,
21 pub fn XcursorCommentsDestroy (_1: *mut XcursorComments) -> (),
22 pub fn XcursorCursorsCreate (_2: *mut Display, _1: c_int) -> *mut XcursorCursors,
23 pub fn XcursorCursorsDestroy (_1: *mut XcursorCursors) -> (),
24 pub fn XcursorFileLoad (_3: *mut FILE, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int,
25 pub fn XcursorFileLoadAllImages (_1: *mut FILE) -> *mut XcursorImages,
26 pub fn XcursorFileLoadImage (_2: *mut FILE, _1: c_int) -> *mut XcursorImage,
27 pub fn XcursorFileLoadImages (_2: *mut FILE, _1: c_int) -> *mut XcursorImages,
28 pub fn XcursorFilenameLoad (_3: *const c_char, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int,
29 pub fn XcursorFilenameLoadAllImages (_1: *const c_char) -> *mut XcursorImages,
30 pub fn XcursorFilenameLoadCursor (_2: *mut Display, _1: *const c_char) -> c_ulong,
31 pub fn XcursorFilenameLoadCursors (_2: *mut Display, _1: *const c_char) -> *mut XcursorCursors,
32 pub fn XcursorFilenameLoadImage (_2: *const c_char, _1: c_int) -> *mut XcursorImage,
33 pub fn XcursorFilenameLoadImages (_2: *const c_char, _1: c_int) -> *mut XcursorImages,
34 pub fn XcursorFilenameSave (_3: *const c_char, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int,
35 pub fn XcursorFilenameSaveImages (_2: *const c_char, _1: *const XcursorImages) -> c_int,
36 pub fn XcursorFileSave (_3: *mut FILE, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int,
37 pub fn XcursorFileSaveImages (_2: *mut FILE, _1: *const XcursorImages) -> c_int,
38 pub fn XcursorGetDefaultSize (_1: *mut Display) -> c_int,
39 pub fn XcursorGetTheme (_1: *mut Display) -> *mut c_char,
40 pub fn XcursorGetThemeCore (_1: *mut Display) -> c_int,
41 pub fn XcursorImageCreate (_2: c_int, _1: c_int) -> *mut XcursorImage,
42 pub fn XcursorImageDestroy (_1: *mut XcursorImage) -> (),
43 pub fn XcursorImageHash (_2: *mut XImage, _1: *mut c_uchar) -> (),
44 pub fn XcursorImageLoadCursor (_2: *mut Display, _1: *const XcursorImage) -> c_ulong,
45 pub fn XcursorImagesCreate (_1: c_int) -> *mut XcursorImages,
46 pub fn XcursorImagesDestroy (_1: *mut XcursorImages) -> (),
47 pub fn XcursorImagesLoadCursor (_2: *mut Display, _1: *const XcursorImages) -> c_ulong,
48 pub fn XcursorImagesLoadCursors (_2: *mut Display, _1: *const XcursorImages) -> *mut XcursorCursors,
49 pub fn XcursorImagesSetName (_2: *mut XcursorImages, _1: *const c_char) -> (),
50 pub fn XcursorLibraryLoadCursor (_2: *mut Display, _1: *const c_char) -> c_ulong,
51 pub fn XcursorLibraryLoadCursors (_2: *mut Display, _1: *const c_char) -> *mut XcursorCursors,
52 pub fn XcursorLibraryLoadImage (_3: *const c_char, _2: *const c_char, _1: c_int) -> *mut XcursorImage,
53 pub fn XcursorLibraryLoadImages (_3: *const c_char, _2: *const c_char, _1: c_int) -> *mut XcursorImages,
54 pub fn XcursorLibraryPath () -> *const c_char,
55 pub fn XcursorLibraryShape (_1: *const c_char) -> c_int,
56 pub fn XcursorNoticeCreateBitmap (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: c_uint) -> (),
57 pub fn XcursorNoticePutBitmap (_3: *mut Display, _2: c_ulong, _1: *mut XImage) -> (),
58 pub fn XcursorSetDefaultSize (_2: *mut Display, _1: c_int) -> c_int,
59 pub fn XcursorSetTheme (_2: *mut Display, _1: *const c_char) -> c_int,
60 pub fn XcursorSetThemeCore (_2: *mut Display, _1: c_int) -> c_int,
61 pub fn XcursorShapeLoadCursor (_2: *mut Display, _1: c_uint) -> c_ulong,
62 pub fn XcursorShapeLoadCursors (_2: *mut Display, _1: c_uint) -> *mut XcursorCursors,
63 pub fn XcursorShapeLoadImage (_3: c_uint, _2: *const c_char, _1: c_int) -> *mut XcursorImage,
64 pub fn XcursorShapeLoadImages (_3: c_uint, _2: *const c_char, _1: c_int) -> *mut XcursorImages,
65 pub fn XcursorSupportsAnim (_1: *mut Display) -> c_int,
66 pub fn XcursorSupportsARGB (_1: *mut Display) -> c_int,
67 pub fn XcursorTryShapeBitmapCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: *mut XColor, _3: *mut XColor, _2: c_uint, _1: c_uint) -> c_ulong,
68 pub fn XcursorTryShapeCursor (_7: *mut Display, _6: c_ulong, _5: c_ulong, _4: c_uint, _3: c_uint, _2: *const XColor, _1: *const XColor) -> c_ulong,
69 pub fn XcursorXcFileLoad (_3: *mut XcursorFile, _2: *mut *mut XcursorComments, _1: *mut *mut XcursorImages) -> c_int,
70 pub fn XcursorXcFileLoadAllImages (_1: *mut XcursorFile) -> *mut XcursorImages,
71 pub fn XcursorXcFileLoadImage (_2: *mut XcursorFile, _1: c_int) -> *mut XcursorImage,
72 pub fn XcursorXcFileLoadImages (_2: *mut XcursorFile, _1: c_int) -> *mut XcursorImages,
73 pub fn XcursorXcFileSave (_3: *mut XcursorFile, _2: *const XcursorComments, _1: *const XcursorImages) -> c_int,
74variadic:
75globals:
76}
77
78//
79// types
80//
81
82pub type XcursorBool = c_int;
83pub type XcursorDim = XcursorUInt;
84pub type XcursorPixel = XcursorUInt;
85pub type XcursorUInt = c_uint;
86
87#[derive(Debug, Clone, Copy)]
88#[repr(C)]
89pub struct _XcursorAnimate {
90 pub cursors: *mut XcursorCursors,
91 pub sequence: c_int,
92}
93pub type XcursorAnimate = _XcursorAnimate;
94
95#[derive(Debug, Clone, Copy)]
96#[repr(C)]
97pub struct _XcursorChunkHeader {
98 pub header: XcursorUInt,
99 pub type_: XcursorUInt,
100 pub subtype: XcursorUInt,
101 pub version: XcursorUInt,
102}
103pub type XcursorChunkHeader = _XcursorChunkHeader;
104
105#[derive(Debug, Clone, Copy)]
106#[repr(C)]
107pub struct _XcursorComment {
108 pub version: XcursorUInt,
109 pub comment_type: XcursorUInt,
110 pub comment: *mut c_char,
111}
112pub type XcursorComment = _XcursorComment;
113
114#[derive(Debug, Clone, Copy)]
115#[repr(C)]
116pub struct _XcursorComments {
117 pub ncomment: c_int,
118 pub comments: *mut *mut XcursorComment,
119}
120pub type XcursorComments = _XcursorComments;
121
122#[derive(Debug, Clone, Copy)]
123#[repr(C)]
124pub struct _XcursorCursors {
125 pub dpy: *mut Display,
126 pub ref_: c_int,
127 pub ncursor: c_int,
128 pub cursors: *mut Cursor,
129}
130pub type XcursorCursors = _XcursorCursors;
131
132#[derive(Debug, Copy)]
133#[repr(C)]
134pub struct _XcursorFile {
135 pub closure: *mut c_void,
136 pub read: Option<unsafe extern "C" fn(*mut XcursorFile, *mut c_uchar, c_int) -> c_int>,
137 pub write: Option<unsafe extern "C" fn(*mut XcursorFile, *mut c_uchar, c_int) -> c_int>,
138 pub seek: Option<unsafe extern "C" fn(*mut XcursorFile, c_long, c_int) -> c_int>,
139}
140pub type XcursorFile = _XcursorFile;
141
142impl Clone for _XcursorFile {
143 fn clone(&self) -> _XcursorFile {
144 _XcursorFile {
145 closure: self.closure,
146 read: self.read,
147 write: self.write,
148 seek: self.seek,
149 }
150 }
151}
152
153#[derive(Debug, Clone, Copy)]
154#[repr(C)]
155pub struct _XcursorFileHeader {
156 pub magic: XcursorUInt,
157 pub header: XcursorUInt,
158 pub version: XcursorUInt,
159 pub ntoc: XcursorUInt,
160 pub tocs: *mut XcursorFileToc,
161}
162pub type XcursorFileHeader = _XcursorFileHeader;
163
164#[derive(Debug, Clone, Copy)]
165#[repr(C)]
166pub struct _XcursorFileToc {
167 pub type_: XcursorUInt,
168 pub subtype: XcursorUInt,
169 pub position: XcursorUInt,
170}
171pub type XcursorFileToc = _XcursorFileToc;
172
173#[derive(Debug, Clone, Copy)]
174#[repr(C)]
175pub struct _XcursorImage {
176 pub version: XcursorUInt,
177 pub size: XcursorDim,
178 pub width: XcursorDim,
179 pub height: XcursorDim,
180 pub xhot: XcursorDim,
181 pub yhot: XcursorDim,
182 pub delay: XcursorUInt,
183 pub pixels: *mut XcursorPixel,
184}
185pub type XcursorImage = _XcursorImage;
186
187#[derive(Debug, Clone, Copy)]
188#[repr(C)]
189pub struct _XcursorImages {
190 pub nimage: c_int,
191 pub images: *mut *mut XcursorImage,
192 pub name: *mut c_char,
193}
194pub type XcursorImages = _XcursorImages;
195