xwayland: improve damage tracking
This commit is contained in:
parent
f4e8d132f3
commit
52c9fac23b
5 changed files with 39 additions and 23 deletions
|
|
@ -1789,8 +1789,14 @@ impl Node for WlSurface {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn node_on_focus(self: Rc<Self>, seat: &WlSeatGlobal) {
|
fn node_on_focus(self: Rc<Self>, seat: &WlSeatGlobal) {
|
||||||
if let Some(tl) = self.toplevel.get() {
|
if let Some(xsurface) = self.ext.get().into_xsurface() {
|
||||||
tl.tl_on_activate();
|
if let Some(window) = xsurface.xwindow.get() {
|
||||||
|
self.client
|
||||||
|
.state
|
||||||
|
.xwayland
|
||||||
|
.queue
|
||||||
|
.push(XWaylandEvent::Activate(window.data.clone()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
seat.focus_surface(&self);
|
seat.focus_surface(&self);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use {
|
||||||
SurfaceExt, WlSurface, WlSurfaceError,
|
SurfaceExt, WlSurface, WlSurfaceError,
|
||||||
},
|
},
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
tree::ToplevelNode,
|
tree::{Node, ToplevelNode, ToplevelNodeBase},
|
||||||
utils::clonecell::CloneCell,
|
utils::clonecell::CloneCell,
|
||||||
xwayland::XWaylandEvent,
|
xwayland::XWaylandEvent,
|
||||||
},
|
},
|
||||||
|
|
@ -58,6 +58,15 @@ impl SurfaceExt for XSurface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn focus_node(&self) -> Option<Rc<dyn Node>> {
|
||||||
|
if let Some(xwindow) = self.xwindow.get() {
|
||||||
|
if xwindow.tl_accepts_keyboard_focus() {
|
||||||
|
return Some(xwindow.x.surface.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
fn into_xsurface(self: Rc<Self>) -> Option<Rc<XSurface>> {
|
fn into_xsurface(self: Rc<Self>) -> Option<Rc<XSurface>> {
|
||||||
Some(self)
|
Some(self)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ impl Xwindow {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
slf.x.xwindow.set(Some(slf.clone()));
|
slf.x.xwindow.set(Some(slf.clone()));
|
||||||
slf.x.surface.set_toplevel(Some(slf.clone()));
|
slf.update_toplevel();
|
||||||
Ok(slf)
|
Ok(slf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,9 +296,25 @@ impl Xwindow {
|
||||||
Change::None => {}
|
Change::None => {}
|
||||||
}
|
}
|
||||||
self.data.state.tree_changed();
|
self.data.state.tree_changed();
|
||||||
if override_redirect {
|
self.damage_override_redirect();
|
||||||
self.data.state.damage(self.data.info.pending_extents.get());
|
}
|
||||||
|
|
||||||
|
fn damage_override_redirect(&self) {
|
||||||
|
if !self.data.info.override_redirect.get() {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
let extents = self.x.surface.extents.get();
|
||||||
|
let (x, y) = self.x.surface.buffer_abs_pos.get().position();
|
||||||
|
let extents = extents.move_(x, y);
|
||||||
|
self.data.state.damage(extents);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update_toplevel(self: &Rc<Self>) {
|
||||||
|
let mut toplevel = None;
|
||||||
|
if !self.data.info.override_redirect.get() {
|
||||||
|
toplevel = Some(self.clone() as _);
|
||||||
|
}
|
||||||
|
self.x.surface.set_toplevel(toplevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -398,14 +414,6 @@ impl ToplevelNodeBase for Xwindow {
|
||||||
&& self.data.info.input_model.get() != XInputModel::None
|
&& self.data.info.input_model.get() != XInputModel::None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tl_on_activate(&self) {
|
|
||||||
self.data
|
|
||||||
.state
|
|
||||||
.xwayland
|
|
||||||
.queue
|
|
||||||
.push(XWaylandEvent::Activate(self.data.clone()));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tl_focus_child(&self) -> Option<Rc<dyn Node>> {
|
fn tl_focus_child(&self) -> Option<Rc<dyn Node>> {
|
||||||
Some(self.x.surface.clone())
|
Some(self.x.surface.clone())
|
||||||
}
|
}
|
||||||
|
|
@ -419,8 +427,6 @@ impl ToplevelNodeBase for Xwindow {
|
||||||
let old = self.data.info.extents.replace(*rect);
|
let old = self.data.info.extents.replace(*rect);
|
||||||
if old != *rect {
|
if old != *rect {
|
||||||
if self.data.info.override_redirect.get() {
|
if self.data.info.override_redirect.get() {
|
||||||
self.data.state.damage(old);
|
|
||||||
self.data.state.damage(*rect);
|
|
||||||
let (x, y) = rect.center();
|
let (x, y) = rect.center();
|
||||||
let output = self.data.state.find_closest_output(x, y).0;
|
let output = self.data.state.find_closest_output(x, y).0;
|
||||||
self.x.surface.set_output(&output);
|
self.x.surface.set_output(&output);
|
||||||
|
|
@ -482,9 +488,7 @@ impl StackedNode for Xwindow {
|
||||||
stacked_node_impl!();
|
stacked_node_impl!();
|
||||||
|
|
||||||
fn stacked_set_visible(&self, visible: bool) {
|
fn stacked_set_visible(&self, visible: bool) {
|
||||||
let extents = self.x.surface.extents.get();
|
self.damage_override_redirect();
|
||||||
let (x, y) = self.x.surface.buffer_abs_pos.get().position();
|
|
||||||
self.data.state.damage(extents.move_(x, y));
|
|
||||||
self.tl_set_visible(visible);
|
self.tl_set_visible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,10 +179,6 @@ pub trait ToplevelNodeBase: Node {
|
||||||
let _ = active;
|
let _ = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tl_on_activate(&self) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tl_focus_child(&self) -> Option<Rc<dyn Node>> {
|
fn tl_focus_child(&self) -> Option<Rc<dyn Node>> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2115,6 +2115,7 @@ impl Wm {
|
||||||
// log::info!("xwin {} or {}", data.window_id, or);
|
// log::info!("xwin {} or {}", data.window_id, or);
|
||||||
if let Some(window) = data.window.get() {
|
if let Some(window) = data.window.get() {
|
||||||
window.tl_destroy();
|
window.tl_destroy();
|
||||||
|
window.update_toplevel();
|
||||||
window.map_status_changed();
|
window.map_status_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue