aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/xdg_shell.rs39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs
index 5cac5d29..840dd599 100644
--- a/src/handlers/xdg_shell.rs
+++ b/src/handlers/xdg_shell.rs
@@ -433,8 +433,12 @@ impl XdgShellHandler for State {
if let Some((mapped, current_output)) = self
.niri
.layout
- .find_window_and_output(toplevel.wl_surface())
+ .find_window_and_output_mut(toplevel.wl_surface())
{
+ // A configure is required in response to this event regardless if there are pending
+ // changes.
+ mapped.set_needs_configure();
+
let window = mapped.window.clone();
if let Some(requested_output) = requested_output {
@@ -446,10 +450,6 @@ impl XdgShellHandler for State {
}
self.niri.layout.set_fullscreen(&window, true);
-
- // A configure is required in response to this event regardless if there are pending
- // changes.
- toplevel.send_configure();
} else if let Some(unmapped) = self.niri.unmapped_windows.get_mut(toplevel.wl_surface()) {
match &mut unmapped.state {
InitialConfigureState::NotConfigured { wants_fullscreen } => {
@@ -513,17 +513,14 @@ impl XdgShellHandler for State {
if let Some((mapped, _)) = self
.niri
.layout
- .find_window_and_output(toplevel.wl_surface())
+ .find_window_and_output_mut(toplevel.wl_surface())
{
- let window = mapped.window.clone();
- self.niri.layout.set_fullscreen(&window, false);
-
// A configure is required in response to this event regardless if there are pending
// changes.
- //
- // FIXME: when unfullscreening to floating, this will send an extra configure with
- // scrolling layout bounds. We should probably avoid it.
- toplevel.send_configure();
+ mapped.set_needs_configure();
+
+ let window = mapped.window.clone();
+ self.niri.layout.set_fullscreen(&window, false);
} else if let Some(unmapped) = self.niri.unmapped_windows.get_mut(toplevel.wl_surface()) {
match &mut unmapped.state {
InitialConfigureState::NotConfigured { wants_fullscreen } => {
@@ -744,7 +741,13 @@ impl XdgDecorationHandler for State {
// A configure is required in response to this event. However, if an initial configure
// wasn't sent, then we will send this as part of the initial configure later.
if toplevel.is_initial_configure_sent() {
- toplevel.send_configure();
+ // If this is a mapped window, flag it as needs configure to avoid duplicate configures.
+ let surface = toplevel.wl_surface();
+ if let Some((mapped, _)) = self.niri.layout.find_window_and_output_mut(surface) {
+ mapped.set_needs_configure();
+ } else {
+ toplevel.send_configure();
+ }
}
}
@@ -757,7 +760,13 @@ impl XdgDecorationHandler for State {
// A configure is required in response to this event. However, if an initial configure
// wasn't sent, then we will send this as part of the initial configure later.
if toplevel.is_initial_configure_sent() {
- toplevel.send_configure();
+ // If this is a mapped window, flag it as needs configure to avoid duplicate configures.
+ let surface = toplevel.wl_surface();
+ if let Some((mapped, _)) = self.niri.layout.find_window_and_output_mut(surface) {
+ mapped.set_needs_configure();
+ } else {
+ toplevel.send_configure();
+ }
}
}
}