Make input popup surface stay on focused surface
@@ -183,14 +183,14 @@ impl<Backend> AnvilState<Backend> {
.get::<FullscreenSurface>()
.and_then(|f| f.get())
{
- if window
+ if let Some((_, point)) = window
.surface_under(
self.pointer_location - output_geo.loc.to_f64(),
WindowSurfaceType::ALL,
)
- .is_some()
{
keyboard.set_focus(self, Some(window.toplevel().wl_surface().clone()), serial);
+ input_method.set_point(&point);
return;
}
}
@@ -200,28 +200,31 @@ impl<Backend> AnvilState<Backend> {
.layer_under(WlrLayer::Overlay, self.pointer_location)
.or_else(|| layers.layer_under(WlrLayer::Top, self.pointer_location))
{
- if layer.can_receive_keyboard_focus()
- && layer
+ if layer.can_receive_keyboard_focus(){
+ if let Some((_, point)) = layer
.surface_under(
self.pointer_location
- output_geo.loc.to_f64()
- layers.layer_geometry(layer).unwrap().loc.to_f64(),
WindowSurfaceType::ALL,
)
- .is_some()
+
{
keyboard.set_focus(self, Some(layer.wl_surface().clone()), serial);
+ input_method.set_point(&point);
return;
}
}
}
+ }
- if let Some((window, _, _)) = self
+ if let Some((window, _, point)) = self
.space
.surface_under(self.pointer_location, WindowSurfaceType::ALL)
{
self.space.raise_window(&window, true);
keyboard.set_focus(self, Some(window.toplevel().wl_surface().clone()), serial);
+ input_method.set_point(&point);
return;
}
@@ -232,17 +235,18 @@ impl<Backend> AnvilState<Backend> {
.layer_under(WlrLayer::Bottom, self.pointer_location)
.or_else(|| layers.layer_under(WlrLayer::Background, self.pointer_location))
{
- if layer.can_receive_keyboard_focus()
- && layer
+ if layer.can_receive_keyboard_focus(){
+ if let Some((_, point)) = layer
.surface_under(
self.pointer_location
- output_geo.loc.to_f64()
- layers.layer_geometry(layer).unwrap().loc.to_f64(),
WindowSurfaceType::ALL,
)
- .is_some()
{
keyboard.set_focus(self, Some(layer.wl_surface().clone()), serial);
+ input_method.set_point(&point);
+ }
}
}
};
@@ -290,10 +294,6 @@ impl<Backend> AnvilState<Backend> {
)
.map(|(s, loc)| (s, loc + layer_loc));
};
- let input_method = self.seat.input_method().unwrap();
- if let Some((_, point)) = under {
- input_method.set_point(&point);
- }
under
}
