xwm: More fixes
This commit is contained in:
parent
1d28574088
commit
9b1221edc5
14 changed files with 311 additions and 80 deletions
|
|
@ -332,10 +332,10 @@ impl CosmicMapped {
|
|||
window.is_activated()
|
||||
}
|
||||
|
||||
pub fn set_size(&self, size: Size<i32, Logical>) {
|
||||
pub fn set_geometry(&self, geo: Rectangle<i32, Logical>) {
|
||||
match &self.element {
|
||||
CosmicMappedInternal::Stack(s) => s.set_size(size),
|
||||
CosmicMappedInternal::Window(w) => w.set_size(size),
|
||||
CosmicMappedInternal::Stack(s) => s.set_geometry(geo),
|
||||
CosmicMappedInternal::Window(w) => w.set_geometry(geo),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,15 +150,16 @@ impl CosmicStack {
|
|||
Point::from((0, TAB_HEIGHT))
|
||||
}
|
||||
|
||||
pub fn set_size(&self, size: Size<i32, Logical>) {
|
||||
pub fn set_geometry(&self, geo: Rectangle<i32, Logical>) {
|
||||
self.0.with_program(|p| {
|
||||
let surface_size = (size.w, size.h - TAB_HEIGHT).into();
|
||||
let loc = (geo.loc.x, geo.loc.y + TAB_HEIGHT);
|
||||
let size = (geo.size.w, geo.size.h - TAB_HEIGHT);
|
||||
|
||||
for window in p.windows.lock().unwrap().iter() {
|
||||
window.set_size(surface_size);
|
||||
window.set_geometry(Rectangle::from_loc_and_size(loc, size));
|
||||
}
|
||||
});
|
||||
self.0.resize(Size::from((size.w, TAB_HEIGHT)));
|
||||
self.0.resize(Size::from((geo.size.w, TAB_HEIGHT)));
|
||||
}
|
||||
|
||||
fn keyboard_leave_if_previous(
|
||||
|
|
|
|||
|
|
@ -102,14 +102,13 @@ impl CosmicSurface {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_size(&self, size: Size<i32, Logical>) {
|
||||
pub fn set_geometry(&self, geo: Rectangle<i32, Logical>) {
|
||||
match self {
|
||||
CosmicSurface::Wayland(window) => window
|
||||
.toplevel()
|
||||
.with_pending_state(|state| state.size = Some(size)),
|
||||
.with_pending_state(|state| state.size = Some(geo.size)),
|
||||
CosmicSurface::X11(surface) => {
|
||||
let rect = Rectangle::from_loc_and_size(surface.geometry().loc, size);
|
||||
let _ = surface.configure(rect);
|
||||
let _ = surface.configure(geo);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
@ -296,6 +295,13 @@ impl CosmicSurface {
|
|||
CosmicSurface::X11(surface) => surface.min_size(),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
.map(|size| {
|
||||
if self.is_decorated() {
|
||||
size + (0, SSD_HEIGHT).into()
|
||||
} else {
|
||||
size
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn max_size(&self) -> Option<Size<i32, Logical>> {
|
||||
|
|
@ -315,6 +321,13 @@ impl CosmicSurface {
|
|||
CosmicSurface::X11(surface) => surface.max_size(),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
.map(|size| {
|
||||
if self.is_decorated() {
|
||||
size + (0, SSD_HEIGHT).into()
|
||||
} else {
|
||||
size
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn send_configure(&self) {
|
||||
|
|
|
|||
|
|
@ -120,12 +120,20 @@ impl CosmicWindow {
|
|||
))
|
||||
}
|
||||
|
||||
pub fn set_size(&self, size: Size<i32, Logical>) {
|
||||
pub fn set_geometry(&self, geo: Rectangle<i32, Logical>) {
|
||||
self.0.with_program(|p| {
|
||||
let surface_size = (size.w, size.h - if p.has_ssd() { SSD_HEIGHT } else { 0 }).into();
|
||||
p.window.set_size(surface_size)
|
||||
let loc = (
|
||||
geo.loc.x,
|
||||
geo.loc.y + if p.has_ssd() { SSD_HEIGHT } else { 0 },
|
||||
);
|
||||
let size = (
|
||||
geo.size.w,
|
||||
geo.size.h - if p.has_ssd() { SSD_HEIGHT } else { 0 },
|
||||
);
|
||||
p.window
|
||||
.set_geometry(Rectangle::from_loc_and_size(loc, size));
|
||||
});
|
||||
self.0.resize(Size::from((size.w, SSD_HEIGHT)));
|
||||
self.0.resize(Size::from((geo.size.w, SSD_HEIGHT)));
|
||||
}
|
||||
|
||||
pub fn surface(&self) -> CosmicSurface {
|
||||
|
|
@ -264,6 +272,7 @@ impl SpaceElement for CosmicWindow {
|
|||
self.0.with_program(|p| {
|
||||
let mut bbox = SpaceElement::bbox(&p.window);
|
||||
if p.has_ssd() {
|
||||
bbox.loc.y -= SSD_HEIGHT;
|
||||
bbox.size.h += SSD_HEIGHT;
|
||||
}
|
||||
bbox
|
||||
|
|
@ -301,6 +310,7 @@ impl SpaceElement for CosmicWindow {
|
|||
self.0.with_program(|p| {
|
||||
let mut geo = SpaceElement::geometry(&p.window);
|
||||
if p.has_ssd() {
|
||||
geo.loc.y -= SSD_HEIGHT;
|
||||
geo.size.h += SSD_HEIGHT;
|
||||
}
|
||||
geo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue