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 | |
5 | use super::xlib::{ |
6 | Atom, Bool, Display, Drawable, Status, Time, Visual, Window, XEvent, XSetWindowAttributes, XID, |
7 | }; |
8 | use std::os::raw::{c_int, c_uint, c_ulong}; |
9 | |
10 | // |
11 | // functions |
12 | // |
13 | |
14 | x11_link! { Xss, xscrnsaver, ["libXss.so.2" , "libXss.so" ], 11, |
15 | pub fn XScreenSaverQueryExtension (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Bool, |
16 | pub fn XScreenSaverQueryVersion (_1: *mut Display, _2: *mut c_int, _3: *mut c_int) -> Status, |
17 | pub fn XScreenSaverAllocInfo () -> *mut XScreenSaverInfo, |
18 | pub fn XScreenSaverQueryInfo (_1: *mut Display, _2: Drawable, _3: *mut XScreenSaverInfo) -> Status, |
19 | pub fn XScreenSaverSelectInput (_1: *mut Display, _2: Drawable, _3: c_ulong) -> (), |
20 | pub fn XScreenSaverSetAttributes (_1: *mut Display, _2: Drawable, _3: c_int, _4: c_int, _5: c_uint, _6: c_uint, _7: c_uint, _8: c_int, _9: c_uint, _10: *mut Visual, _11: c_ulong, _12: *mut XSetWindowAttributes) -> (), |
21 | pub fn XScreenSaverUnsetAttributes (_1: *mut Display, _2: Drawable) -> (), |
22 | pub fn XScreenSaverRegister (_1: *mut Display, _2: c_int, _3: XID, _4: Atom) -> Status, |
23 | pub fn XScreenSaverUnregister (_1: *mut Display, _2: c_int) -> Status, |
24 | pub fn XScreenSaverGetRegistered (_1: *mut Display, _2: c_int, _3: *mut XID, _4: *mut Atom) -> Status, |
25 | pub fn XScreenSaverSuspend (_1: *mut Display, _2: Bool) -> (), |
26 | variadic: |
27 | globals: |
28 | } |
29 | |
30 | // |
31 | // types |
32 | // |
33 | |
34 | #[derive (Debug, Clone, Copy, PartialEq)] |
35 | #[repr (C)] |
36 | pub struct XScreenSaverInfo { |
37 | pub window: Window, |
38 | pub state: c_int, |
39 | pub kind: c_int, |
40 | pub til_or_since: c_ulong, |
41 | pub idle: c_ulong, |
42 | pub eventMask: c_ulong, |
43 | } |
44 | |
45 | // |
46 | // event structures |
47 | // |
48 | |
49 | #[derive (Debug, Clone, Copy, PartialEq)] |
50 | #[repr (C)] |
51 | pub struct XScreenSaverNotifyEvent { |
52 | pub type_: c_int, |
53 | pub serial: c_ulong, |
54 | pub send_event: Bool, |
55 | pub display: *mut Display, |
56 | pub window: Window, |
57 | pub root: Window, |
58 | pub state: c_int, |
59 | pub kind: c_int, |
60 | pub forced: Bool, |
61 | pub time: Time, |
62 | } |
63 | |
64 | event_conversions_and_tests! { |
65 | xss_notify: XScreenSaverNotifyEvent, |
66 | } |
67 | |
68 | // |
69 | // constants |
70 | // |
71 | |
72 | pub const ScreenSaverName: &str = "MIT-SCREEN-SAVER" ; |
73 | pub const ScreenSaverPropertyName: &str = "_MIT_SCREEN_SAVER_ID" ; |
74 | |
75 | pub const ScreenSaverNotifyMask: c_ulong = 0x00000001; |
76 | pub const ScreenSaverCycleMask: c_ulong = 0x00000002; |
77 | |
78 | pub const ScreenSaverMajorVersion: c_int = 1; |
79 | pub const ScreenSaverMinorVersion: c_int = 1; |
80 | |
81 | pub const ScreenSaverOff: c_int = 0; |
82 | pub const ScreenSaverOn: c_int = 1; |
83 | pub const ScreenSaverCycle: c_int = 2; |
84 | pub const ScreenSaverDisabled: c_int = 3; |
85 | |
86 | pub const ScreenSaverBlanked: c_int = 0; |
87 | pub const ScreenSaverInternal: c_int = 1; |
88 | pub const ScreenSaverExternal: c_int = 2; |
89 | |
90 | pub const ScreenSaverNotify: c_int = 0; |
91 | pub const ScreenSaverNumberEvents: c_int = 1; |
92 | |