Fix: improve edge pointer accuracy
This commit is contained in:
parent
9789187416
commit
8955024bff
7 changed files with 43 additions and 32 deletions
|
|
@ -530,7 +530,7 @@ impl CosmicStack {
|
|||
let geo = p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)].geometry();
|
||||
|
||||
if surface_type.contains(WindowSurfaceType::TOPLEVEL) {
|
||||
let point_i32 = relative_pos.to_i32_round::<i32>();
|
||||
let point_i32 = relative_pos.to_i32_floor::<i32>();
|
||||
if (point_i32.x - geo.loc.x >= -RESIZE_BORDER && point_i32.x - geo.loc.x < 0)
|
||||
|| (point_i32.y - geo.loc.y >= -RESIZE_BORDER && point_i32.y - geo.loc.y < 0)
|
||||
|| (point_i32.x - geo.loc.x >= geo.size.w
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ impl Focus {
|
|||
location: Point<f64, Logical>,
|
||||
) -> Option<Focus> {
|
||||
let geo = surface.geometry();
|
||||
let loc = location.to_i32_round::<i32>() - geo.loc;
|
||||
let loc = location.to_i32_floor::<i32>() - geo.loc;
|
||||
if loc.y < 0 && loc.x < 0 {
|
||||
Some(Focus::ResizeTopLeft)
|
||||
} else if loc.y < 0 && loc.x >= geo.size.w {
|
||||
|
|
@ -292,7 +292,7 @@ impl CosmicWindow {
|
|||
{
|
||||
let geo = p.window.geometry();
|
||||
|
||||
let point_i32 = relative_pos.to_i32_round::<i32>();
|
||||
let point_i32 = relative_pos.to_i32_floor::<i32>();
|
||||
let ssd_height = if has_ssd { SSD_HEIGHT } else { 0 };
|
||||
|
||||
if (point_i32.x - geo.loc.x >= -RESIZE_BORDER && point_i32.x - geo.loc.x < 0)
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ impl PointerGrab<State> for MenuGrab {
|
|||
let mut bbox = elem.iced.bbox();
|
||||
bbox.loc = elem.position.as_logical();
|
||||
|
||||
bbox.contains(event_location.to_i32_round())
|
||||
bbox.contains(event_location.to_i32_floor())
|
||||
}) {
|
||||
let element = &mut elements[i];
|
||||
|
||||
|
|
@ -753,7 +753,7 @@ impl TouchGrab<State> for MenuGrab {
|
|||
let mut bbox = elem.iced.bbox();
|
||||
bbox.loc = elem.position.as_logical();
|
||||
|
||||
bbox.contains(event_location.to_i32_round())
|
||||
bbox.contains(event_location.to_i32_floor())
|
||||
}) {
|
||||
let element = &mut elements[i];
|
||||
|
||||
|
|
|
|||
|
|
@ -3150,7 +3150,7 @@ impl TilingLayout {
|
|||
location_f64: Point<f64, Local>,
|
||||
seat: &Seat<State>,
|
||||
) -> Option<KeyboardFocusTarget> {
|
||||
let location = location_f64.to_i32_round();
|
||||
let location = location_f64.to_i32_floor();
|
||||
|
||||
for (mapped, geo) in self.mapped() {
|
||||
if !mapped.bbox().contains((location - geo.loc).as_logical()) {
|
||||
|
|
@ -3177,7 +3177,7 @@ impl TilingLayout {
|
|||
location_f64: Point<f64, Local>,
|
||||
seat: &Seat<State>,
|
||||
) -> Option<KeyboardFocusTarget> {
|
||||
let location = location_f64.to_i32_round();
|
||||
let location = location_f64.to_i32_floor();
|
||||
|
||||
for (mapped, geo) in self.mapped() {
|
||||
// Tiled windows are rendered cropped to their tile (`geo`), so input must be bound to the tile as well
|
||||
|
|
@ -3209,7 +3209,7 @@ impl TilingLayout {
|
|||
overview: OverviewMode,
|
||||
seat: &Seat<State>,
|
||||
) -> Option<(PointerFocusTarget, Point<f64, Local>)> {
|
||||
let location = location_f64.to_i32_round();
|
||||
let location = location_f64.to_i32_floor();
|
||||
|
||||
if matches!(overview, OverviewMode::None) {
|
||||
for (mapped, geo) in self.mapped() {
|
||||
|
|
@ -3244,7 +3244,7 @@ impl TilingLayout {
|
|||
) -> Option<(PointerFocusTarget, Point<f64, Local>)> {
|
||||
let tree = &self.queue.trees.back().unwrap().0;
|
||||
let root = tree.root_node_id()?;
|
||||
let location = location_f64.to_i32_round();
|
||||
let location = location_f64.to_i32_floor();
|
||||
|
||||
if matches!(overview, OverviewMode::None) {
|
||||
for (mapped, geo) in self.mapped() {
|
||||
|
|
@ -3305,7 +3305,7 @@ impl TilingLayout {
|
|||
..
|
||||
},
|
||||
)) => {
|
||||
let test_point = (location.to_f64() - last_geometry.loc.to_f64()
|
||||
let test_point = (location_f64 - last_geometry.loc.to_f64()
|
||||
+ mapped.geometry().loc.to_f64().as_local())
|
||||
.as_logical();
|
||||
mapped
|
||||
|
|
@ -3410,7 +3410,7 @@ impl TilingLayout {
|
|||
}
|
||||
|
||||
let location_f64 = location_f64.unwrap();
|
||||
let location = location_f64.to_i32_round();
|
||||
let location = location_f64.to_i32_floor();
|
||||
|
||||
if matches!(
|
||||
overview.active_trigger(),
|
||||
|
|
@ -3660,7 +3660,7 @@ impl TilingLayout {
|
|||
TargetZone::WindowStack(id, last_geometry)
|
||||
} else {
|
||||
let left_right = {
|
||||
let relative_loc = (location.x - last_geometry.loc.x) as f64;
|
||||
let relative_loc = location_f64.x - last_geometry.loc.x as f64;
|
||||
if relative_loc < last_geometry.size.w as f64 / 2.0 {
|
||||
(Direction::Left, relative_loc / last_geometry.size.w as f64)
|
||||
} else {
|
||||
|
|
@ -3671,7 +3671,7 @@ impl TilingLayout {
|
|||
}
|
||||
};
|
||||
let up_down = {
|
||||
let relative_loc = (location.y - last_geometry.loc.y) as f64;
|
||||
let relative_loc = location_f64.y - last_geometry.loc.y as f64;
|
||||
if relative_loc < last_geometry.size.h as f64 / 2.0 {
|
||||
(Direction::Up, relative_loc / last_geometry.size.h as f64)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ impl Workspace {
|
|||
location: Point<f64, Global>,
|
||||
seat: &Seat<State>,
|
||||
) -> Option<KeyboardFocusTarget> {
|
||||
if !self.output.geometry().contains(location.to_i32_round()) {
|
||||
if !self.output.geometry().contains(location.to_i32_floor()) {
|
||||
return None;
|
||||
}
|
||||
let location = location.to_local(&self.output);
|
||||
|
|
@ -834,7 +834,7 @@ impl Workspace {
|
|||
location: Point<f64, Global>,
|
||||
seat: &Seat<State>,
|
||||
) -> Option<KeyboardFocusTarget> {
|
||||
if !self.output.geometry().contains(location.to_i32_round()) {
|
||||
if !self.output.geometry().contains(location.to_i32_floor()) {
|
||||
return None;
|
||||
}
|
||||
let location = location.to_local(&self.output);
|
||||
|
|
@ -884,7 +884,7 @@ impl Workspace {
|
|||
overview: OverviewMode,
|
||||
seat: &Seat<State>,
|
||||
) -> Option<(PointerFocusTarget, Point<f64, Global>)> {
|
||||
if !self.output.geometry().contains(location.to_i32_round()) {
|
||||
if !self.output.geometry().contains(location.to_i32_floor()) {
|
||||
return None;
|
||||
}
|
||||
let location = location.to_local(&self.output);
|
||||
|
|
@ -934,7 +934,7 @@ impl Workspace {
|
|||
overview: OverviewMode,
|
||||
seat: &Seat<State>,
|
||||
) -> Option<(PointerFocusTarget, Point<f64, Global>)> {
|
||||
if !self.output.geometry().contains(location.to_i32_round()) {
|
||||
if !self.output.geometry().contains(location.to_i32_floor()) {
|
||||
return None;
|
||||
}
|
||||
let location = location.to_local(&self.output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue