text-input: improve damage tracking
This commit is contained in:
parent
52c9fac23b
commit
5ae1742075
2 changed files with 13 additions and 6 deletions
|
|
@ -174,6 +174,7 @@ impl ZwpInputMethodV2RequestHandler for ZwpInputMethodV2 {
|
||||||
version: self.version,
|
version: self.version,
|
||||||
tracker: Default::default(),
|
tracker: Default::default(),
|
||||||
positioning_scheduled: Cell::new(false),
|
positioning_scheduled: Cell::new(false),
|
||||||
|
was_on_screen: Default::default(),
|
||||||
});
|
});
|
||||||
track!(self.client, popup);
|
track!(self.client, popup);
|
||||||
self.client.add_client_obj(&popup)?;
|
self.client.add_client_obj(&popup)?;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ pub struct ZwpInputPopupSurfaceV2 {
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
pub tracker: Tracker<Self>,
|
pub tracker: Tracker<Self>,
|
||||||
pub positioning_scheduled: Cell<bool>,
|
pub positioning_scheduled: Cell<bool>,
|
||||||
|
pub was_on_screen: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SurfaceExt for ZwpInputPopupSurfaceV2 {
|
impl SurfaceExt for ZwpInputPopupSurfaceV2 {
|
||||||
|
|
@ -57,6 +58,7 @@ impl ZwpInputPopupSurfaceV2 {
|
||||||
&& self.client.state.root_visible();
|
&& self.client.state.root_visible();
|
||||||
self.surface.set_visible(is_visible);
|
self.surface.set_visible(is_visible);
|
||||||
if was_visible != is_visible {
|
if was_visible != is_visible {
|
||||||
|
self.was_on_screen.set(false);
|
||||||
if is_visible {
|
if is_visible {
|
||||||
self.schedule_positioning();
|
self.schedule_positioning();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -107,12 +109,16 @@ impl ZwpInputPopupSurfaceV2 {
|
||||||
rect = rect2;
|
rect = rect2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.surface.buffer_abs_pos.set(
|
let old = self.surface.buffer_abs_pos.get();
|
||||||
self.surface
|
let new = old.at_point(rect.x1() - extents.x1(), rect.y1() - extents.y1());
|
||||||
.buffer_abs_pos
|
if self.was_on_screen.get() && new != old {
|
||||||
.get()
|
self.damage();
|
||||||
.at_point(rect.x1() - extents.x1(), rect.y1() - extents.y1()),
|
}
|
||||||
);
|
self.surface.buffer_abs_pos.set(new);
|
||||||
|
if !self.was_on_screen.get() || new != old {
|
||||||
|
self.damage();
|
||||||
|
}
|
||||||
|
self.was_on_screen.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn install(self: &Rc<Self>) -> Result<(), ZwpInputPopupSurfaceV2Error> {
|
pub fn install(self: &Rc<Self>) -> Result<(), ZwpInputPopupSurfaceV2Error> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue