Correct fullscreen mouse input on winit

This commit is contained in:
Ottatop 2023-08-08 18:54:37 -05:00
parent 7a8fc983a9
commit 77695c666e

View file

@ -5,6 +5,7 @@ use std::collections::HashMap;
use crate::{ use crate::{
api::msg::{CallbackId, Modifier, ModifierMask, OutgoingMsg}, api::msg::{CallbackId, Modifier, ModifierMask, OutgoingMsg},
focus::FocusTarget, focus::FocusTarget,
state::WithState,
window::WindowElement, window::WindowElement,
}; };
use smithay::{ use smithay::{
@ -74,6 +75,13 @@ impl<B: Backend> State<B> {
let layers = layer_map_for_output(output); let layers = layer_map_for_output(output);
// I think I'm going a bit too far with the functional stuff // I think I'm going a bit too far with the functional stuff
[output]
.into_iter()
.flat_map(|op| op.with_state(|state| state.tags.clone()))
.find(|tag| tag.fullscreen_window().is_some())
.and_then(|tag| tag.fullscreen_window())
.map(|window| (FocusTarget::from(window), output_geo.loc))
.or_else(|| {
layers layers
.layer_under(wlr_layer::Layer::Overlay, point) .layer_under(wlr_layer::Layer::Overlay, point)
.or_else(|| layers.layer_under(wlr_layer::Layer::Top, point)) .or_else(|| layers.layer_under(wlr_layer::Layer::Top, point))
@ -81,6 +89,7 @@ impl<B: Backend> State<B> {
let layer_loc = layers.layer_geometry(layer).expect("no layer geo").loc; let layer_loc = layers.layer_geometry(layer).expect("no layer geo").loc;
(FocusTarget::from(layer.clone()), output_geo.loc + layer_loc) (FocusTarget::from(layer.clone()), output_geo.loc + layer_loc)
}) })
})
.or_else(|| { .or_else(|| {
self.space self.space
.element_under(point) .element_under(point)