diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 920608d..d273e9f 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -21,10 +21,16 @@ fn main() { | |||
21 | let (conn, screen_num) = xcb::Connection::connect(None) | 21 | let (conn, screen_num) = xcb::Connection::connect(None) |
22 | .unwrap_or_else(|e| panic!("Unable to connect to X session: {}", e)); | 22 | .unwrap_or_else(|e| panic!("Unable to connect to X session: {}", e)); |
23 | let setup = conn.get_setup(); | 23 | let setup = conn.get_setup(); |
24 | let screen = setup.roots().nth(screen_num as usize).unwrap(); | 24 | let screen = setup |
25 | .roots() | ||
26 | .nth(screen_num as usize) | ||
27 | .unwrap_or_else(|| panic!("Error accessing screen!")); | ||
25 | 28 | ||
26 | let depths = screen.allowed_depths(); | 29 | let depths = screen.allowed_depths(); |
27 | let mut alpha_depths = depths.filter(|d| d.depth() == 32u8); | 30 | let mut alpha_depths = depths.filter(|d| d.depth() == 32u8).peekable(); |
31 | if alpha_depths.peek().is_none() { | ||
32 | panic!("Alpha channel not found!"); | ||
33 | } | ||
28 | 34 | ||
29 | let visual = alpha_depths | 35 | let visual = alpha_depths |
30 | .next() | 36 | .next() |
@@ -55,7 +61,7 @@ fn main() { | |||
55 | win_start_y, | 61 | win_start_y, |
56 | win_width, | 62 | win_width, |
57 | win_height, | 63 | win_height, |
58 | 2, | 64 | 0, |
59 | xcb::WINDOW_CLASS_INPUT_OUTPUT as u16, | 65 | xcb::WINDOW_CLASS_INPUT_OUTPUT as u16, |
60 | visual.visual_id(), | 66 | visual.visual_id(), |
61 | &[ | 67 | &[ |