gdritter repos knurling / abdd363
Add xinerama functionality Getty Ritter 5 years ago
1 changed file(s) with 28 addition(s) and 23 deletion(s). Collapse all Expand all
1818 // TODO: this should be a function of font size
1919 ht: 36,
2020 };
21 let screens = d.get_widths();
22 println!("{:?}", screens);
23 let mut w = Window::create(d, size)?;
24 // set some window-manager properties: this is a dock
25 w.change_property("_NET_WM_WINDOW_TYPE", &["_NET_WM_WINDOW_TYPE_DOCK"])?;
26 // ...and should push other windows out of the way
27 w.change_property("_NET_WM_STRUT", &[0i64, 0, size.ht as i64, 0])?;
28 w.change_property(
29 "_NET_WM_STRUT_PARTIAL",
30 &[ 0, 0, size.ht as i64, 0,
31 0, 0, 0, 0,
32 0, size.wd as i64, 0, 0,
33 ],
34 )?;
21 let mut ws = Vec::new();
22 for (x_off, wd) in in d.get_widths() {
23 let size = Size { wd, ht: 36 };
24 let mut w = Window::create(d, size)?;
25 // set some window-manager properties: this is a dock
26 w.change_property("_NET_WM_WINDOW_TYPE", &["_NET_WM_WINDOW_TYPE_DOCK"])?;
27 // ...and should push other windows out of the way
28 w.change_property("_NET_WM_STRUT", &[x_off as i64, 0, size.ht as i64, 0])?;
29 w.change_property(
30 "_NET_WM_STRUT_PARTIAL",
31 &[ 0, 0, size.ht as i64, 0,
32 0, 0, 0, 0,
33 0, size.wd as i64, 0, 0,
34 ],
35 )?;
3536
36 // we won't ever see this, but for good measure.
37 w.set_title("rbar")?;
38 // we care about some input events!
39 w.set_input_masks()?;
40 w.set_protocols()?;
41 // and now show it!
42 w.map();
37 // we won't ever see this, but for good measure.
38 w.set_title("rbar")?;
39 // we care about some input events!
40 w.set_input_masks()?;
41 w.set_protocols()?;
42 // and now show it!
43 w.map();
44 ws.push(w);
45 }
4346
4447 // let's grab the cairo context here
4548 let surf = w.get_cairo_surface();
4750
4851 // we do some grossness with file descriptors later, so we need
4952 // the file descriptors we care about here
50 let window_fd = w.get_fd();
53 let window_fds = ws.map{ |w| w.get_fd() };
5154 let stdin_fd = std::io::stdin().as_raw_fd();
5255
5356 let mut fds = unsafe { std::mem::uninitialized() };
8386 unsafe {
8487 // set up the FD set to be the X11 fd and the state of stdin
8588 libc::FD_ZERO(&mut fds);
86 libc::FD_SET(window_fd, &mut fds);
89 for fd in window_fds {
90 libc::FD_SET(fd, &mut fds);
91 }
8792 libc::FD_SET(stdin_fd, &mut fds);
8893 timer.tv_sec = 5;
8994