From 0d8c30219cca22d14d451e9b217799ef427ecdae Mon Sep 17 00:00:00 2001 From: Ottatop Date: Thu, 13 Jul 2023 19:02:35 -0500 Subject: [PATCH] Rename enum members for clarity --- src/handlers.rs | 6 +++--- src/layout.rs | 22 +++++++++++----------- src/window/window_state.rs | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/handlers.rs b/src/handlers.rs index 7f0cbf6..bc02abb 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -116,7 +116,7 @@ impl CompositorHandler for State { if let Some(window) = self.window_for_surface(surface) { window.with_state(|state| { - if let WindowResizeState::WaitingForCommit(new_pos) = state.resize_state { + if let WindowResizeState::Acknowledged(new_pos) = state.resize_state { state.resize_state = WindowResizeState::Idle; self.space.map_element(window.clone(), new_pos, false); } @@ -400,12 +400,12 @@ impl XdgShellHandler for State { fn ack_configure(&mut self, surface: WlSurface, configure: Configure) { if let Some(window) = self.window_for_surface(&surface) { window.with_state(|state| { - if let WindowResizeState::WaitingForAck(serial, new_loc) = state.resize_state { + if let WindowResizeState::Requested(serial, new_loc) = state.resize_state { match &configure { Configure::Toplevel(configure) => { if configure.serial >= serial { tracing::debug!("acked configure, new loc is {:?}", new_loc); - state.resize_state = WindowResizeState::WaitingForCommit(new_loc); + state.resize_state = WindowResizeState::Acknowledged(new_loc); } } Configure::Popup(_) => todo!(), diff --git a/src/layout.rs b/src/layout.rs index ed66e4f..339b9fb 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -64,7 +64,7 @@ impl Layout { }); master.with_state(|state| { - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( master.toplevel().send_configure(), (output_loc.x, output_loc.y).into(), ); @@ -76,7 +76,7 @@ impl Layout { state.size = Some(new_master_size); }); master.with_state(|state| { - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( master.toplevel().send_configure(), (output_loc.x, output_loc.y).into(), ); @@ -122,7 +122,7 @@ impl Layout { }); win.with_state(|state| { - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( win.toplevel().send_configure(), (output_geo.size.w / 2 + output_loc.x, y + output_loc.y).into(), ); @@ -148,7 +148,7 @@ impl Layout { }); window.with_state(|state| { - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( window.toplevel().send_configure(), (output_loc.x, output_loc.y).into(), ); @@ -206,7 +206,7 @@ impl Layout { as i32, ) .into(); - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( win1.toplevel().send_configure(), new_loc, ); @@ -219,7 +219,7 @@ impl Layout { as i32, ) .into(); - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( win2.toplevel().send_configure(), new_loc, ); @@ -243,7 +243,7 @@ impl Layout { }); window.with_state(|state| { - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( window.toplevel().send_configure(), (output_loc.x, output_loc.y).into(), ); @@ -309,7 +309,7 @@ impl Layout { as i32, ) .into(); - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( win1.toplevel().send_configure(), new_loc, ); @@ -322,7 +322,7 @@ impl Layout { as i32, ) .into(); - state.resize_state = WindowResizeState::WaitingForAck( + state.resize_state = WindowResizeState::Requested( win2.toplevel().send_configure(), new_loc, ); @@ -371,12 +371,12 @@ impl State { let serial = win1.toplevel().send_configure(); win1.with_state(|state| { - state.resize_state = WindowResizeState::WaitingForAck(serial, win2_loc); + state.resize_state = WindowResizeState::Requested(serial, win2_loc); }); let serial = win2.toplevel().send_configure(); win2.with_state(|state| { - state.resize_state = WindowResizeState::WaitingForAck(serial, win1_loc); + state.resize_state = WindowResizeState::Requested(serial, win1_loc); }); let mut elems = self diff --git a/src/window/window_state.rs b/src/window/window_state.rs index 3bd9032..19df3da 100644 --- a/src/window/window_state.rs +++ b/src/window/window_state.rs @@ -70,12 +70,12 @@ pub enum WindowResizeState { Idle, /// The window has received a configure request with a new size. The desired location and the /// configure request's serial should be provided here. - WaitingForAck(Serial, Point), + Requested(Serial, Point), /// The client has received the configure request and has successfully changed its size. It's /// now safe to move the window in [`CompositorHandler.commit()`] without flickering. /// /// [`CompositorHandler.commit()`]: smithay::wayland::compositor::CompositorHandler#tymethod.commit - WaitingForCommit(Point), + Acknowledged(Point), } pub enum Float {