aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/mod.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-03-19 14:41:17 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-03-19 18:29:13 +0400
commit3963f537a4182dbcd8e1e2f262ee105473facc56 (patch)
tree942f802863d1f8f63bbe68b53ab2d091e3c7dda9 /src/handlers/mod.rs
parentf31e105043a9fae0fae3dcfe0feb7ea1193d5f77 (diff)
downloadniri-3963f537a4182dbcd8e1e2f262ee105473facc56.tar.gz
niri-3963f537a4182dbcd8e1e2f262ee105473facc56.tar.bz2
niri-3963f537a4182dbcd8e1e2f262ee105473facc56.zip
Wrap mapped windows in a Mapped
Diffstat (limited to 'src/handlers/mod.rs')
-rw-r--r--src/handlers/mod.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 4d3a606f..46ee79b6 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -144,7 +144,7 @@ impl InputMethodHandler for State {
self.niri
.layout
.find_window_and_output(parent)
- .map(|(window, _)| window.geometry())
+ .map(|(mapped, _)| mapped.window.geometry())
.unwrap_or_default()
}
}
@@ -333,25 +333,24 @@ impl ForeignToplevelHandler for State {
}
fn activate(&mut self, wl_surface: WlSurface) {
- if let Some((window, _)) = self.niri.layout.find_window_and_output(&wl_surface) {
- let window = window.clone();
+ if let Some((mapped, _)) = self.niri.layout.find_window_and_output(&wl_surface) {
+ let window = mapped.window.clone();
self.niri.layout.activate_window(&window);
self.niri.queue_redraw_all();
}
}
fn close(&mut self, wl_surface: WlSurface) {
- if let Some((window, _)) = self.niri.layout.find_window_and_output(&wl_surface) {
- window.toplevel().expect("no x11 support").send_close();
+ if let Some((mapped, _)) = self.niri.layout.find_window_and_output(&wl_surface) {
+ mapped.toplevel().send_close();
}
}
fn set_fullscreen(&mut self, wl_surface: WlSurface, wl_output: Option<WlOutput>) {
- if let Some((window, current_output)) = self.niri.layout.find_window_and_output(&wl_surface)
+ if let Some((mapped, current_output)) = self.niri.layout.find_window_and_output(&wl_surface)
{
- if !window
+ if !mapped
.toplevel()
- .expect("no x11 support")
.current_state()
.capabilities
.contains(xdg_toplevel::WmCapabilities::Fullscreen)
@@ -359,7 +358,7 @@ impl ForeignToplevelHandler for State {
return;
}
- let window = window.clone();
+ let window = mapped.window.clone();
if let Some(requested_output) = wl_output.as_ref().and_then(Output::from_resource) {
if &requested_output != current_output {
@@ -374,8 +373,8 @@ impl ForeignToplevelHandler for State {
}
fn unset_fullscreen(&mut self, wl_surface: WlSurface) {
- if let Some((window, _)) = self.niri.layout.find_window_and_output(&wl_surface) {
- let window = window.clone();
+ if let Some((mapped, _)) = self.niri.layout.find_window_and_output(&wl_surface) {
+ let window = mapped.window.clone();
self.niri.layout.set_fullscreen(&window, false);
}
}