Make MonitorId::get_position() return (i32, i32) instead of (u32, u32) because it can be negative on Windows (#324)

This commit is contained in:
kryptan 2017-10-19 20:08:05 +03:00 committed by tomaka
parent 229029f2da
commit 4e4db1749d
12 changed files with 27 additions and 19 deletions

View file

@ -37,7 +37,7 @@ struct OutputInfo {
id: u32,
scale: f32,
pix_size: (u32, u32),
pix_pos: (u32, u32),
pix_pos: (i32, i32),
name: String
}
@ -162,7 +162,7 @@ impl wl_output::Handler for WaylandEnv {
{
for m in self.monitors.iter_mut().filter(|m| m.output.equals(proxy)) {
m.name = format!("{} ({})", model, make);
m.pix_pos = (x as u32, y as u32);
m.pix_pos = (x, y);
break;
}
}
@ -397,7 +397,7 @@ impl MonitorId {
(0,0)
}
pub fn get_position(&self) -> (u32, u32) {
pub fn get_position(&self) -> (i32, i32) {
let mut guard = self.ctxt.evq.lock().unwrap();
let state = guard.state();
let env = state.get_handler::<WaylandEnv>(self.ctxt.env_id);

View file

@ -204,6 +204,8 @@ impl Window {
let mut find = default;
for monitor in monitors {
let (mx, my) = monitor.get_position();
let mx = mx as u32;
let my = my as u32;
let (mw, mh) = monitor.get_dimensions();
let (mxo, myo) = (mx+mw-1, my+mh-1);
let (ox, oy) = (cmp::max(wx, mx), cmp::max(wy, my));