Skip to content

Commit

Permalink
wl_subsurface: remove size from position
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Dec 7, 2024
1 parent 6998e73 commit 138b840
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/ifs/wl_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 2 additions & 4 deletions src/ifs/wl_surface/wl_subsurface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use {
},
leaks::Tracker,
object::{Object, Version},
rect::Rect,
utils::{
clonecell::CloneCell,
linkedlist::{LinkedNode, NodeRef},
Expand Down Expand Up @@ -36,7 +35,7 @@ pub struct WlSubsurface {
unique_id: SubsurfaceId,
pub surface: Rc<WlSurface>,
pub(super) parent: Rc<WlSurface>,
pub position: Cell<Rect>,
pub position: Cell<(i32, i32)>,
sync_requested: Cell<bool>,
sync_ancestor: Cell<bool>,
node: RefCell<Option<LinkedNode<StackElement>>>,
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down

0 comments on commit 138b840

Please sign in to comment.