Render everything when there's a fullscreen window

This commit is contained in:
Ottatop 2024-04-06 21:06:40 -05:00
parent bf4e270bfc
commit a0aa30fec1
2 changed files with 24 additions and 91 deletions

View file

@ -183,32 +183,7 @@ impl State {
let layers = layer_map_for_output(output);
let top_fullscreen_window = output
.with_state(|state| state.focus_stack.stack.clone())
.into_iter()
.rev()
.find(|win| {
win.with_state(|state| {
state.fullscreen_or_maximized.is_fullscreen()
&& output.with_state(|op_state| {
op_state
.focused_tags()
.any(|op_tag| state.tags.contains(op_tag))
})
})
});
if let Some(window) = top_fullscreen_window {
let loc = self
.space
.element_location(&window)
.expect("called elem loc on unmapped win")
- window.geometry().loc;
window
.surface_under(point - loc.to_f64(), WindowSurfaceType::ALL)
.map(|(surf, surf_loc)| (PointerFocusTarget::WlSurface(surf), surf_loc + loc))
} else if let (Some(layer), _) | (None, Some(layer)) = (
if let (Some(layer), _) | (None, Some(layer)) = (
layers.layer_under(wlr_layer::Layer::Overlay, point),
layers.layer_under(wlr_layer::Layer::Top, point),
) {

View file

@ -22,20 +22,13 @@ use smithay::{
},
input::pointer::{CursorImageAttributes, CursorImageStatus},
output::Output,
reexports::{
wayland_protocols::xdg::shell::server::xdg_toplevel,
wayland_server::protocol::wl_surface::WlSurface,
},
reexports::wayland_server::protocol::wl_surface::WlSurface,
render_elements,
utils::{Logical, Physical, Point, Scale},
wayland::{compositor, shell::wlr_layer},
};
use crate::{
backend::Backend,
state::{State, WithState},
window::WindowElement,
};
use crate::{backend::Backend, state::State, window::WindowElement};
use self::pointer::{PointerElement, PointerRenderElement};
@ -293,67 +286,32 @@ where
// | base it on if it's a descendant or not
output_render_elements.extend(o_r_elements.map(OutputRenderElements::from));
let top_fullscreen_window = windows.iter().rev().find(|win| {
let is_wayland_actually_fullscreen = {
if let Some(toplevel) = win.toplevel() {
toplevel
.current_state()
.states
.contains(xdg_toplevel::State::Fullscreen)
} else {
true
}
};
let LayerRenderElements {
background,
bottom,
top,
overlay,
} = layer_render_elements(output, renderer, scale);
win.with_state(|state| {
state.fullscreen_or_maximized.is_fullscreen()
&& output.with_state(|op_state| {
op_state
.focused_tags()
.any(|op_tag| state.tags.contains(op_tag))
})
}) && is_wayland_actually_fullscreen
});
let window_render_elements = tag_render_elements::<R>(output, &windows, space, renderer, scale);
// If fullscreen windows exist, render only the topmost one
if let Some(window) = top_fullscreen_window {
let window_render_elements: Vec<WaylandSurfaceRenderElement<_>> =
window.render_elements(renderer, (0, 0).into(), scale, 1.0);
// Elements render from top to bottom
output_render_elements.extend(
window_render_elements
.into_iter()
.map(OutputRenderElements::from),
);
} else {
let LayerRenderElements {
background,
bottom,
top,
overlay,
} = layer_render_elements(output, renderer, scale);
output_render_elements.extend(
overlay
.into_iter()
.chain(top)
.map(OutputRenderElements::from),
);
let window_render_elements =
tag_render_elements::<R>(output, &windows, space, renderer, scale);
output_render_elements.extend(window_render_elements);
// Elements render from top to bottom
output_render_elements.extend(
overlay
.into_iter()
.chain(top)
.map(OutputRenderElements::from),
);
output_render_elements.extend(window_render_elements);
output_render_elements.extend(
bottom
.into_iter()
.chain(background)
.map(OutputRenderElements::from),
);
}
output_render_elements.extend(
bottom
.into_iter()
.chain(background)
.map(OutputRenderElements::from),
);
output_render_elements
}