diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-11-02 10:35:25 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-11-02 10:53:55 +0300 |
| commit | 0e7e398df3a816b7dec1de8902af83d29a08562a (patch) | |
| tree | 68df6a7952484139d12af6fd2c9b10e6b292a443 /src/handlers | |
| parent | 86bdc6898bc8a13368ba852692ff0cc248345128 (diff) | |
| download | niri-0e7e398df3a816b7dec1de8902af83d29a08562a.tar.gz niri-0e7e398df3a816b7dec1de8902af83d29a08562a.tar.bz2 niri-0e7e398df3a816b7dec1de8902af83d29a08562a.zip | |
Replace current_state() with with_toplevel_role()
Avoid microallocations that happen in current_state().
Diffstat (limited to 'src/handlers')
| -rw-r--r-- | src/handlers/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 5b44caf0..ed9f224c 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -74,7 +74,7 @@ use crate::protocols::gamma_control::{GammaControlHandler, GammaControlManagerSt use crate::protocols::mutter_x11_interop::MutterX11InteropHandler; use crate::protocols::output_management::{OutputManagementHandler, OutputManagementManagerState}; use crate::protocols::screencopy::{Screencopy, ScreencopyHandler, ScreencopyManagerState}; -use crate::utils::{output_size, send_scale_transform}; +use crate::utils::{output_size, send_scale_transform, with_toplevel_role}; use crate::{ delegate_foreign_toplevel, delegate_gamma_control, delegate_mutter_x11_interop, delegate_output_management, delegate_screencopy, @@ -459,12 +459,12 @@ impl ForeignToplevelHandler for State { fn set_fullscreen(&mut self, wl_surface: WlSurface, wl_output: Option<WlOutput>) { if let Some((mapped, current_output)) = self.niri.layout.find_window_and_output(&wl_surface) { - if !mapped - .toplevel() - .current_state() - .capabilities - .contains(xdg_toplevel::WmCapabilities::Fullscreen) - { + let has_fullscreen_cap = with_toplevel_role(mapped.toplevel(), |role| { + role.current + .capabilities + .contains(xdg_toplevel::WmCapabilities::Fullscreen) + }); + if !has_fullscreen_cap { return; } |
