CN2CI25XYZMVKYBKTSIVKO5GNDFXQ3CE2ZKS623D5EULTPTKFHDQC
F3IDYEIHR2FA7SCE2MYVQSUQ5SOPGJ5IKBTS2V3HLM52SWGQ322AC
BQFOYJRTLAFIBZ3SOERSUB2ZXMXJUAROXOGMGWHJW4CVBRT4R5QAC
LSQ7OPL7Z5WJDO7ZZS3D4UPMEEWUUF2LNQ3FZUWWFUVZEXA7CIOAC
AYQYCR7JKWTAZASLQTY5DPVI6A5MN6X4XMPC3GBS5KJRH3EGRPIQC
RPECDMZ4O7MMU32H6Z7EW75GRVEQ6IJYNPWSV54HUPTCX5H7I26QC
VODZCAIINDFQAU6RUV5VBRGJSMCWNMYAQ3ZE56SNBYU2WOSHFOMAC
let (screen, x, y) = (focus.screen, focus.pos.x, focus.pos.y);
let (screen, x) = self.normalize_x(screen, x);
let (screen, y) = self.normalize_y(screen, y);
Focus {
screen: screen,
pos: Dimensions { x: x, y: y },
}
self.normalize_y(self.normalize_x(focus))
fn normalize_x(&self, focus: Index, x: i32) -> (Index, i32) {
let screen = &self.screens[focus as usize];
if x < 20 {
fn normalize_x(&self, focus: Focus) -> Focus {
let screen = &self.screens[focus.index as usize];
if focus.pos.x <= 0 {
Some(focus) => self.normalize_x(focus, x + self.screens[focus as usize].size.x - 40),
None => (focus, 0),
Some(index) => {
let new_screen = &self.screens[index as usize];
return self.normalize_x(Focus {
index: index,
pos: Dimensions {
x: focus.pos.x + new_screen.size.x - 2,
y: focus.pos.y * new_screen.size.y / screen.size.y,
}
})
},
None => if focus.pos.x < 0 {
return Focus {
index: focus.index,
pos: Dimensions {
x: 0,
y: focus.pos.y,
}
}
},
Some(focus) => self.normalize_x(focus, x - screen.size.x + 40),
None => (focus, screen.size.x - 1),
Some(index) => {
let new_screen = &self.screens[index as usize];
return self.normalize_x(Focus {
index: index,
pos: Dimensions {
x: focus.pos.x - screen.size.x + 2,
y: focus.pos.y * new_screen.size.y / screen.size.y,
}
})
},
None => if focus.pos.x > screen.size.x - 1 {
return Focus {
index: focus.index,
pos: Dimensions {
x: screen.size.x - 1,
y: focus.pos.y,
}
}
},
fn normalize_y(&self, focus: Index, y: i32) -> (Index, i32) {
let screen = &self.screens[focus as usize];
if y < 20 {
fn normalize_y(&self, focus: Focus) -> Focus {
let screen = &self.screens[focus.index as usize];
if focus.pos.y <= 0 {
Some(focus) => self.normalize_y(focus, y + self.screens[focus as usize].size.y - 40),
None => (focus, 0),
Some(index) => {
let new_screen = &self.screens[index as usize];
return self.normalize_y(Focus {
index: index,
pos: Dimensions {
x: focus.pos.x * new_screen.size.y / screen.size.x,
y: focus.pos.y + new_screen.size.y - 2,
}
})
},
None => if focus.pos.y < 0 {
return Focus {
index: focus.index,
pos: Dimensions {
x: focus.pos.x,
y: 0,
}
}
},
Some(focus) => self.normalize_y(focus, y - screen.size.y + 40),
None => (focus, screen.size.y - 1),
Some(index) => {
let new_screen = &self.screens[index as usize];
return self.normalize_y(Focus {
index: index,
pos: Dimensions {
x: focus.pos.x * new_screen.size.y / screen.size.x,
y: focus.pos.y - screen.size.y + 2,
}
})
},
None => if focus.pos.y > screen.size.y - 1 {
return Focus {
index: focus.index,
pos: Dimensions {
x: focus.pos.x,
y: screen.size.y - 1,
}
}
},