autocommit 2022-02-04 16:52:11 CET
This commit is contained in:
parent
bb1639a2ae
commit
89bfd2ffcd
21 changed files with 599 additions and 46 deletions
|
|
@ -122,6 +122,19 @@ impl XdgSurface {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_absolute_desired_extents(&self, ext: &Rect) {
|
||||
let prev = self.absolute_desired_extents.replace(*ext);
|
||||
if ext.x1() != prev.x1() || ext.y1() != prev.y1() {
|
||||
let (mut x1, mut y1) = (ext.x1(), ext.y1());
|
||||
if let Some(geo) = self.geometry.get() {
|
||||
x1 -= geo.x1();
|
||||
y1 -= geo.y1();
|
||||
}
|
||||
self.surface.set_absolute_position(x1, y1);
|
||||
self.update_popup_positions();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn surface_active_changed(&self, active: bool) {
|
||||
if let Some(ext) = self.ext.get() {
|
||||
ext.surface_active_changed(active);
|
||||
|
|
@ -331,7 +344,6 @@ impl XdgSurface {
|
|||
let popups = self.popups.lock();
|
||||
for popup in popups.values() {
|
||||
popup.update_absolute_position();
|
||||
popup.xdg.update_popup_positions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ impl XdgPopup {
|
|||
}
|
||||
}
|
||||
self.relative_position.set(rel_pos);
|
||||
self.xdg.absolute_desired_extents.set(abs_pos);
|
||||
self.xdg.set_absolute_desired_extents(&abs_pos);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -182,8 +182,7 @@ impl XdgPopup {
|
|||
let rel = self.relative_position.get();
|
||||
let parent = parent.absolute_desired_extents.get();
|
||||
self.xdg
|
||||
.absolute_desired_extents
|
||||
.set(rel.move_(parent.x1(), parent.y1()));
|
||||
.set_absolute_desired_extents(&rel.move_(parent.x1(), parent.y1()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,12 @@ impl XdgToplevel {
|
|||
}
|
||||
|
||||
fn set_parent(&self, parser: MsgParser<'_, '_>) -> Result<(), SetParentError> {
|
||||
let _req: SetParent = self.xdg.surface.client.parse(self, parser)?;
|
||||
let req: SetParent = self.xdg.surface.client.parse(self, parser)?;
|
||||
let mut parent = None;
|
||||
if req.parent.is_some() {
|
||||
parent = Some(self.xdg.surface.client.get_xdg_toplevel(req.parent)?);
|
||||
}
|
||||
self.parent.set(parent);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -329,6 +334,7 @@ impl XdgToplevel {
|
|||
self.xdg.set_workspace(&workspace);
|
||||
let output = workspace.output.get();
|
||||
let output_rect = output.position.get();
|
||||
log::info!("or = {:?}", output_rect);
|
||||
let position = {
|
||||
let extents = self.xdg.extents.get().to_origin();
|
||||
let width = extents.width();
|
||||
|
|
@ -343,6 +349,7 @@ impl XdgToplevel {
|
|||
}
|
||||
Rect::new_sized(x1, y1, width, height).unwrap()
|
||||
};
|
||||
log::info!("pos = {:?}", position);
|
||||
let state = &self.xdg.surface.client.state;
|
||||
let floater = Rc::new(FloatNode {
|
||||
id: state.node_ids.next(),
|
||||
|
|
@ -365,6 +372,7 @@ impl XdgToplevel {
|
|||
}
|
||||
|
||||
fn map_tiled(self: &Rc<Self>) {
|
||||
log::info!("map tiled");
|
||||
let state = &self.xdg.surface.client.state;
|
||||
let seat = state.seat_queue.last();
|
||||
if let Some(seat) = seat {
|
||||
|
|
@ -472,7 +480,7 @@ impl Node for XdgToplevel {
|
|||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
let nw = rect.width();
|
||||
let nh = rect.height();
|
||||
let de = self.xdg.absolute_desired_extents.replace(*rect);
|
||||
let de = self.xdg.absolute_desired_extents.get();
|
||||
if de.width() != nw || de.height() != nh {
|
||||
self.xdg
|
||||
.surface
|
||||
|
|
@ -481,9 +489,7 @@ impl Node for XdgToplevel {
|
|||
self.xdg.send_configure();
|
||||
self.xdg.surface.client.flush();
|
||||
}
|
||||
if de.x1() != rect.x1() || de.y1() != rect.y1() {
|
||||
self.xdg.update_popup_positions();
|
||||
}
|
||||
self.xdg.set_absolute_desired_extents(rect);
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue