From 138b84032acb645ae1e53bab34f5460365a37136 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sat, 7 Dec 2024 15:01:55 +0100 Subject: [PATCH] wl_subsurface: remove size from position --- src/ifs/wl_surface.rs | 7 +++---- src/ifs/wl_surface/wl_subsurface.rs | 6 ++---- src/renderer.rs | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/ifs/wl_surface.rs b/src/ifs/wl_surface.rs index 7f52a62d..4a08a955 100644 --- a/src/ifs/wl_surface.rs +++ b/src/ifs/wl_surface.rs @@ -742,8 +742,7 @@ impl WlSurface { if let Some(children) = self.children.borrow_mut().deref_mut() { for ss in children.subsurfaces.values() { let pos = ss.position.get(); - ss.surface - .set_absolute_position(x1 + pos.x1(), y1 + pos.y1()); + ss.surface.set_absolute_position(x1 + pos.0, y1 + pos.1); } } for (_, con) in &self.text_input_connections { @@ -878,7 +877,7 @@ impl WlSurface { let ce = ss.surface.extents.get(); if !ce.is_empty() { let cp = ss.position.get(); - let ce = ce.move_(cp.x1(), cp.y1()); + let ce = ce.move_(cp.0, cp.1); extents = if extents.is_empty() { ce } else { @@ -1517,7 +1516,7 @@ impl WlSurface { } let pos = child.sub_surface.position.get(); let ext = child.sub_surface.surface.extents.get(); - let ext = ext.move_(pos.x1(), pos.y1()); + let ext = ext.move_(pos.0, pos.1); if ext.contains(x, y) { let (x, y) = ext.translate(x, y); if let Some(res) = child.sub_surface.surface.find_surface_at(x, y) { diff --git a/src/ifs/wl_surface/wl_subsurface.rs b/src/ifs/wl_surface/wl_subsurface.rs index db788222..d0baf383 100644 --- a/src/ifs/wl_surface/wl_subsurface.rs +++ b/src/ifs/wl_surface/wl_subsurface.rs @@ -7,7 +7,6 @@ use { }, leaks::Tracker, object::{Object, Version}, - rect::Rect, utils::{ clonecell::CloneCell, linkedlist::{LinkedNode, NodeRef}, @@ -36,7 +35,7 @@ pub struct WlSubsurface { unique_id: SubsurfaceId, pub surface: Rc, pub(super) parent: Rc, - pub position: Cell, + pub position: Cell<(i32, i32)>, sync_requested: Cell, sync_ancestor: Cell, node: RefCell>>, @@ -137,8 +136,7 @@ impl WlSubsurface { } if let Some((mut x, mut y)) = pending.position.take() { client_wire_scale_to_logical!(self.surface.client, x, y); - self.position - .set(self.surface.buffer_abs_pos.get().at_point(x, y)); + self.position.set((x, y)); let (parent_x, parent_y) = self.parent.buffer_abs_pos.get().position(); self.surface .set_absolute_position(parent_x + x, parent_y + y); diff --git a/src/renderer.rs b/src/renderer.rs index a7eb723b..f4f37cd4 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -389,12 +389,12 @@ impl Renderer<'_> { continue; } let pos = child.sub_surface.position.get(); - let (x1, y1) = self.base.scale_point(pos.x1(), pos.y1()); + let (x1, y1) = self.base.scale_point(pos.0, pos.1); self.render_surface_scaled( &child.sub_surface.surface, x + x1, y + y1, - Some((pos.x1(), pos.y1())), + Some(pos), bounds, true, );