Rename enum members for clarity

This commit is contained in:
Ottatop 2023-07-13 19:02:35 -05:00 committed by Ottatop
parent cc8ec304d4
commit 0d8c30219c
3 changed files with 16 additions and 16 deletions

View file

@ -116,7 +116,7 @@ impl<B: Backend> CompositorHandler for State<B> {
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<B: Backend> XdgShellHandler for State<B> {
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!(),

View file

@ -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<B: Backend> State<B> {
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

View file

@ -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<i32, Logical>),
Requested(Serial, Point<i32, Logical>),
/// 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<i32, Logical>),
Acknowledged(Point<i32, Logical>),
}
pub enum Float {