mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Possibly fix some unsync subsurfaces not redrawing output
This commit is contained in:
@@ -284,22 +284,29 @@ impl CompositorHandler for State {
|
|||||||
if let Some(output) = self.output_for_popup(&popup) {
|
if let Some(output) = self.output_for_popup(&popup) {
|
||||||
self.niri.queue_redraw(&output.clone());
|
self.niri.queue_redraw(&output.clone());
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This might be a layer-shell surface.
|
// This might be a layer-shell surface.
|
||||||
self.layer_shell_handle_commit(surface);
|
if self.layer_shell_handle_commit(surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// This might be a cursor surface.
|
// This might be a cursor surface.
|
||||||
if matches!(&self.niri.cursor_manager.cursor_image(), CursorImageStatus::Surface(s) if s == surface)
|
if matches!(
|
||||||
{
|
&self.niri.cursor_manager.cursor_image(),
|
||||||
|
CursorImageStatus::Surface(s) if s == &root_surface
|
||||||
|
) {
|
||||||
// FIXME: granular redraws for cursors.
|
// FIXME: granular redraws for cursors.
|
||||||
self.niri.queue_redraw_all();
|
self.niri.queue_redraw_all();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This might be a DnD icon surface.
|
// This might be a DnD icon surface.
|
||||||
if self.niri.dnd_icon.as_ref() == Some(surface) {
|
if self.niri.dnd_icon.as_ref() == Some(&root_surface) {
|
||||||
// FIXME: granular redraws for cursors.
|
// FIXME: granular redraws for cursors.
|
||||||
self.niri.queue_redraw_all();
|
self.niri.queue_redraw_all();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This might be a lock surface.
|
// This might be a lock surface.
|
||||||
@@ -308,7 +315,7 @@ impl CompositorHandler for State {
|
|||||||
if let Some(lock_surface) = &state.lock_surface {
|
if let Some(lock_surface) = &state.lock_surface {
|
||||||
if lock_surface.wl_surface() == &root_surface {
|
if lock_surface.wl_surface() == &root_surface {
|
||||||
self.niri.queue_redraw(&output.clone());
|
self.niri.queue_redraw(&output.clone());
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+49
-36
@@ -3,7 +3,7 @@ use smithay::desktop::{layer_map_for_output, LayerSurface, PopupKind, WindowSurf
|
|||||||
use smithay::output::Output;
|
use smithay::output::Output;
|
||||||
use smithay::reexports::wayland_server::protocol::wl_output::WlOutput;
|
use smithay::reexports::wayland_server::protocol::wl_output::WlOutput;
|
||||||
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
|
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
|
||||||
use smithay::wayland::compositor::with_states;
|
use smithay::wayland::compositor::{get_parent, with_states};
|
||||||
use smithay::wayland::shell::wlr_layer::{
|
use smithay::wayland::shell::wlr_layer::{
|
||||||
Layer, LayerSurface as WlrLayerSurface, LayerSurfaceData, WlrLayerShellHandler,
|
Layer, LayerSurface as WlrLayerSurface, LayerSurfaceData, WlrLayerShellHandler,
|
||||||
WlrLayerShellState,
|
WlrLayerShellState,
|
||||||
@@ -68,52 +68,65 @@ impl WlrLayerShellHandler for State {
|
|||||||
delegate_layer_shell!(State);
|
delegate_layer_shell!(State);
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
pub fn layer_shell_handle_commit(&mut self, surface: &WlSurface) {
|
pub fn layer_shell_handle_commit(&mut self, surface: &WlSurface) -> bool {
|
||||||
let Some(output) = self
|
let mut root_surface = surface.clone();
|
||||||
|
while let Some(parent) = get_parent(&root_surface) {
|
||||||
|
root_surface = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
let output = self
|
||||||
.niri
|
.niri
|
||||||
.layout
|
.layout
|
||||||
.outputs()
|
.outputs()
|
||||||
.find(|o| {
|
.find(|o| {
|
||||||
let map = layer_map_for_output(o);
|
let map = layer_map_for_output(o);
|
||||||
map.layer_for_surface(surface, WindowSurfaceType::TOPLEVEL)
|
map.layer_for_surface(&root_surface, WindowSurfaceType::TOPLEVEL)
|
||||||
.is_some()
|
.is_some()
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned();
|
||||||
else {
|
let Some(output) = output else {
|
||||||
return;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
let initial_configure_sent = with_states(surface, |states| {
|
if surface == &root_surface {
|
||||||
states
|
let initial_configure_sent = with_states(surface, |states| {
|
||||||
.data_map
|
states
|
||||||
.get::<LayerSurfaceData>()
|
.data_map
|
||||||
.unwrap()
|
.get::<LayerSurfaceData>()
|
||||||
.lock()
|
.unwrap()
|
||||||
.unwrap()
|
.lock()
|
||||||
.initial_configure_sent
|
.unwrap()
|
||||||
});
|
.initial_configure_sent
|
||||||
|
|
||||||
let mut map = layer_map_for_output(&output);
|
|
||||||
|
|
||||||
// arrange the layers before sending the initial configure
|
|
||||||
// to respect any size the client may have sent
|
|
||||||
map.arrange();
|
|
||||||
// send the initial configure if relevant
|
|
||||||
if !initial_configure_sent {
|
|
||||||
let layer = map
|
|
||||||
.layer_for_surface(surface, WindowSurfaceType::TOPLEVEL)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let scale = output.current_scale();
|
|
||||||
let transform = output.current_transform();
|
|
||||||
with_states(surface, |data| {
|
|
||||||
send_scale_transform(surface, data, scale, transform);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
layer.layer_surface().send_configure();
|
let mut map = layer_map_for_output(&output);
|
||||||
}
|
|
||||||
drop(map);
|
|
||||||
|
|
||||||
self.niri.output_resized(&output);
|
// arrange the layers before sending the initial configure
|
||||||
|
// to respect any size the client may have sent
|
||||||
|
map.arrange();
|
||||||
|
// send the initial configure if relevant
|
||||||
|
if !initial_configure_sent {
|
||||||
|
let layer = map
|
||||||
|
.layer_for_surface(surface, WindowSurfaceType::TOPLEVEL)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let scale = output.current_scale();
|
||||||
|
let transform = output.current_transform();
|
||||||
|
with_states(surface, |data| {
|
||||||
|
send_scale_transform(surface, data, scale, transform);
|
||||||
|
});
|
||||||
|
|
||||||
|
layer.layer_surface().send_configure();
|
||||||
|
}
|
||||||
|
drop(map);
|
||||||
|
|
||||||
|
// This will call queue_redraw() inside.
|
||||||
|
self.niri.output_resized(&output);
|
||||||
|
} else {
|
||||||
|
// This is an unsync layer-shell subsurface.
|
||||||
|
self.niri.queue_redraw(&output);
|
||||||
|
}
|
||||||
|
|
||||||
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user