1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use std::process::exit;
use xcb::base;
pub enum WmError {
CouldNotEstablishHandlers,
CouldNotConnect(base::ConnError),
CouldNotAcquireScreen,
CouldNotRegisterAtom(String),
CouldNotAllocateColors,
OtherWmRunning,
RandRVersionMismatch,
RandRSetupFailed,
CouldNotGetScreenResources,
BadCrtc,
ConnectionInterrupted,
IOError,
}
impl WmError {
pub fn handle(self) -> ! {
match self {
WmError::CouldNotEstablishHandlers => error!("could not establish signal handlers"),
WmError::CouldNotConnect(e) => error!("could not connect: {:?}", e),
WmError::CouldNotAcquireScreen => error!("could not acquire screen"),
WmError::CouldNotRegisterAtom(s) => error!("could not register atom {}", s),
WmError::CouldNotAllocateColors => error!("could not allocate border colors"),
WmError::OtherWmRunning => error!("another wm is running"),
WmError::RandRVersionMismatch => error!("randr 1.2 not supported"),
WmError::RandRSetupFailed => error!("randr setup failed"),
WmError::CouldNotGetScreenResources => error!("could not get screen resources"),
WmError::BadCrtc => error!("the set of CRTCs obtained was empty"),
WmError::ConnectionInterrupted => error!("connection interrupted"),
WmError::IOError => error!("i/o error occured"),
};
exit(1);
}
}
pub fn handle_logger_error() {
println!("ERROR:main: could not initialize logger");
exit(1);
}