aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2019-11-27 18:59:08 +0000
committerAkshay <[email protected]>2019-11-27 18:59:08 +0000
commitb3305076ed2739b8d6ed7a65e77bca20f03321b4 (patch)
treefc178c31907cc4e6d869c705163470030848c264
parentbfb634cd11d7a1089b4de0237b1e0a9aad7f253b (diff)
todos, cawmints
-rw-r--r--src/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index f26d107..35e5035 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -26,12 +26,14 @@ fn main() {
26 .nth(screen_num as usize) 26 .nth(screen_num as usize)
27 .unwrap_or_else(|| panic!("Error accessing screen!")); 27 .unwrap_or_else(|| panic!("Error accessing screen!"));
28 28
29 // fetch all depths
29 let depths = screen.allowed_depths(); 30 let depths = screen.allowed_depths();
30 let mut alpha_depths = depths.filter(|d| d.depth() == 32u8).peekable(); 31 let mut alpha_depths = depths.filter(|d| d.depth() == 32u8).peekable();
31 if alpha_depths.peek().is_none() { 32 if alpha_depths.peek().is_none() {
32 panic!("Alpha channel not found!"); 33 panic!("Alpha channel not found!");
33 } 34 }
34 35
36 // fetch a visual supporting alpha channels
35 let visual = alpha_depths 37 let visual = alpha_depths
36 .next() 38 .next()
37 .unwrap() 39 .unwrap()
@@ -66,8 +68,8 @@ fn main() {
66 visual.visual_id(), 68 visual.visual_id(),
67 &[ 69 &[
68 (xcb::CW_BACK_PIXEL, 0x00), 70 (xcb::CW_BACK_PIXEL, 0x00),
69 (xcb::CW_BORDER_PIXEL, 0x00), 71 (xcb::CW_BORDER_PIXEL, 0x00), // you need this if you use alpha apparently
70 //(xcb::CW_OVERRIDE_REDIRECT, 1u32), 72 (xcb::CW_OVERRIDE_REDIRECT, 1u32), // dont take focus
71 (xcb::CW_EVENT_MASK, xcb::EVENT_MASK_EXPOSURE), 73 (xcb::CW_EVENT_MASK, xcb::EVENT_MASK_EXPOSURE),
72 (xcb::CW_COLORMAP, colormap), 74 (xcb::CW_COLORMAP, colormap),
73 ], 75 ],
@@ -79,7 +81,7 @@ fn main() {
79 gfx_ctx, 81 gfx_ctx,
80 win, 82 win,
81 &[ 83 &[
82 (xcb::GC_FOREGROUND, screen.white_pixel()), 84 (xcb::GC_FOREGROUND, screen.white_pixel()), // TODO: support different colors here
83 (xcb::GC_GRAPHICS_EXPOSURES, 0), 85 (xcb::GC_GRAPHICS_EXPOSURES, 0),
84 (xcb::GC_LINE_WIDTH, config.thickness), 86 (xcb::GC_LINE_WIDTH, config.thickness),
85 ], 87 ],
@@ -125,6 +127,7 @@ fn main() {
125 ); 127 );
126 128
127 let mut circles = (0..config.no_of_circles) 129 let mut circles = (0..config.no_of_circles)
130 .rev() // TODO: add grow/shrink as option
128 .map(|i| { 131 .map(|i| {
129 xcb::Arc::new( 132 xcb::Arc::new(
130 (config.max_size as i16) / (2 * config.no_of_circles as i16) * i as i16, 133 (config.max_size as i16) / (2 * config.no_of_circles as i16) * i as i16,
@@ -150,6 +153,7 @@ fn main() {
150 Some(e) => { 153 Some(e) => {
151 let r = e.response_type() & !0x80; 154 let r = e.response_type() & !0x80;
152 match r { 155 match r {
156 // the window is mapped to display
153 xcb::EXPOSE => { 157 xcb::EXPOSE => {
154 let pointer = xcb::query_pointer(&conn, win).get_reply().unwrap(); 158 let pointer = xcb::query_pointer(&conn, win).get_reply().unwrap();
155 let p_x = pointer.root_x(); 159 let p_x = pointer.root_x();