aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/compositor.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-12-19 13:29:22 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-12-19 13:32:13 +0400
commitc29a049245ffa0eb737114774da4c01c09897dfc (patch)
tree508eaab69c37a4257546401def160ed6298b7bae /src/handlers/compositor.rs
parentd6b62ad09d049524b5c734f90ea86f6252d32088 (diff)
downloadniri-c29a049245ffa0eb737114774da4c01c09897dfc.tar.gz
niri-c29a049245ffa0eb737114774da4c01c09897dfc.tar.bz2
niri-c29a049245ffa0eb737114774da4c01c09897dfc.zip
Fix some cases of incomplete search for surface output
Most visibly, fixes screen not immediately redrawing upon layer-shell popup commits. There's still a number of places with questionable handling left, mostly to do with subsurfaces (like, find_popup_root_surface() doesn't go up to subsurfaces), and session-lock. I don't have good clients to test these.
Diffstat (limited to 'src/handlers/compositor.rs')
-rw-r--r--src/handlers/compositor.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/handlers/compositor.rs b/src/handlers/compositor.rs
index 94ee8549..30963f47 100644
--- a/src/handlers/compositor.rs
+++ b/src/handlers/compositor.rs
@@ -1,7 +1,6 @@
use std::collections::hash_map::Entry;
use smithay::backend::renderer::utils::{on_commit_buffer_handler, with_renderer_surface_state};
-use smithay::desktop::find_popup_root_surface;
use smithay::input::pointer::CursorImageStatus;
use smithay::reexports::calloop::Interest;
use smithay::reexports::wayland_server::protocol::wl_buffer;
@@ -30,7 +29,12 @@ impl CompositorHandler for State {
}
fn new_subsurface(&mut self, surface: &WlSurface, parent: &WlSurface) {
- if let Some((_, output)) = self.niri.layout.find_window_and_output(parent) {
+ let mut root = parent.clone();
+ while let Some(parent) = get_parent(&root) {
+ root = parent;
+ }
+
+ if let Some(output) = self.niri.output_for_root(&root) {
let scale = output.current_scale().integer_scale();
let transform = output.current_transform();
with_states(surface, |data| {
@@ -150,11 +154,8 @@ impl CompositorHandler for State {
// This might be a popup.
self.popups_handle_commit(surface);
if let Some(popup) = self.niri.popups.find_popup(surface) {
- if let Ok(root) = find_popup_root_surface(&popup) {
- let root_window_output = self.niri.layout.find_window_and_output(&root);
- if let Some((_window, output)) = root_window_output {
- self.niri.queue_redraw(output);
- }
+ if let Some(output) = self.output_for_popup(&popup) {
+ self.niri.queue_redraw(output);
}
}