mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
mapped: Add needs_configure flag
Allows to de-duplicate configures from requests that require one.
This commit is contained in:
+24
-15
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user