diff --git a/src/ifs/wl_seat/text_input/zwp_input_method_v2.rs b/src/ifs/wl_seat/text_input/zwp_input_method_v2.rs index 7d25398e..52239870 100644 --- a/src/ifs/wl_seat/text_input/zwp_input_method_v2.rs +++ b/src/ifs/wl_seat/text_input/zwp_input_method_v2.rs @@ -174,6 +174,7 @@ impl ZwpInputMethodV2RequestHandler for ZwpInputMethodV2 { version: self.version, tracker: Default::default(), positioning_scheduled: Cell::new(false), + was_on_screen: Default::default(), }); track!(self.client, popup); self.client.add_client_obj(&popup)?; diff --git a/src/ifs/wl_surface/zwp_input_popup_surface_v2.rs b/src/ifs/wl_surface/zwp_input_popup_surface_v2.rs index 5cdc5eba..4f246b23 100644 --- a/src/ifs/wl_surface/zwp_input_popup_surface_v2.rs +++ b/src/ifs/wl_surface/zwp_input_popup_surface_v2.rs @@ -23,6 +23,7 @@ pub struct ZwpInputPopupSurfaceV2 { pub version: Version, pub tracker: Tracker, pub positioning_scheduled: Cell, + pub was_on_screen: Cell, } impl SurfaceExt for ZwpInputPopupSurfaceV2 { @@ -57,6 +58,7 @@ impl ZwpInputPopupSurfaceV2 { && self.client.state.root_visible(); self.surface.set_visible(is_visible); if was_visible != is_visible { + self.was_on_screen.set(false); if is_visible { self.schedule_positioning(); } else { @@ -107,12 +109,16 @@ impl ZwpInputPopupSurfaceV2 { rect = rect2; } } - self.surface.buffer_abs_pos.set( - self.surface - .buffer_abs_pos - .get() - .at_point(rect.x1() - extents.x1(), rect.y1() - extents.y1()), - ); + let old = self.surface.buffer_abs_pos.get(); + let new = old.at_point(rect.x1() - extents.x1(), rect.y1() - extents.y1()); + if self.was_on_screen.get() && new != old { + self.damage(); + } + 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) -> Result<(), ZwpInputPopupSurfaceV2Error> {