config: move window operations
This commit is contained in:
parent
274e7c0602
commit
05c40cb46d
2 changed files with 143 additions and 113 deletions
|
|
@ -328,24 +328,6 @@ impl ConfigProxyHandler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_get_window_fullscreen(&self, window: Window) -> Result<(), CphError> {
|
||||
let tl = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowFullscreen {
|
||||
fullscreen: tl.tl_data().is_fullscreen.get(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_window_fullscreen(
|
||||
&self,
|
||||
window: Window,
|
||||
fullscreen: bool,
|
||||
) -> Result<(), CphError> {
|
||||
let tl = self.get_window(window)?;
|
||||
tl.tl_set_fullscreen(fullscreen, None);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_keymap(&self, seat: Seat, keymap: Keymap) -> Result<(), CphError> {
|
||||
let seat = self.get_seat(seat)?;
|
||||
let keymap = if keymap.is_invalid() {
|
||||
|
|
@ -427,12 +409,6 @@ impl ConfigProxyHandler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_window_close(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
window.tl_close();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_seat_focus(&self, seat: Seat, direction: Direction) -> Result<(), CphError> {
|
||||
let seat = self.get_seat(seat)?;
|
||||
seat.move_focus(direction.into());
|
||||
|
|
@ -447,18 +423,6 @@ impl ConfigProxyHandler {
|
|||
})
|
||||
}
|
||||
|
||||
fn handle_window_move(&self, window: Window, direction: Direction) -> Result<(), CphError> {
|
||||
self.state.with_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
if let Some(float) = window.tl_data().float.get() {
|
||||
float.move_by_direction(direction.into());
|
||||
} else if let Some(c) = toplevel_parent_container(&*window) {
|
||||
c.move_child(window, direction.into());
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn handle_get_repeat_rate(&self, seat: Seat) -> Result<(), CphError> {
|
||||
let seat = self.get_seat(seat)?;
|
||||
let (rate, delay) = seat.get_rate();
|
||||
|
|
@ -713,20 +677,6 @@ impl ConfigProxyHandler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_get_window_float_pinned(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowFloatPinned {
|
||||
pinned: window.tl_pinned(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_window_float_pinned(&self, window: Window, pinned: bool) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
window.tl_set_pinned(true, pinned);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_get_seat_mono(&self, seat: Seat) -> Result<(), CphError> {
|
||||
let seat = self.get_seat(seat)?;
|
||||
self.respond(Response::GetMono {
|
||||
|
|
@ -743,26 +693,6 @@ impl ConfigProxyHandler {
|
|||
})
|
||||
}
|
||||
|
||||
fn handle_get_window_mono(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowMono {
|
||||
mono: toplevel_parent_container(&*window)
|
||||
.map(|c| c.mono_child.is_some())
|
||||
.unwrap_or(false),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_window_mono(&self, window: Window, mono: bool) -> Result<(), CphError> {
|
||||
self.state.with_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
if let Some(c) = toplevel_parent_container(&*window) {
|
||||
c.set_mono(mono.then_some(window.as_ref()));
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn handle_get_seat_split(&self, seat: Seat) -> Result<(), CphError> {
|
||||
let seat = self.get_seat(seat)?;
|
||||
self.respond(Response::GetSplit {
|
||||
|
|
@ -827,27 +757,6 @@ impl ConfigProxyHandler {
|
|||
})
|
||||
}
|
||||
|
||||
fn handle_get_window_split(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowSplit {
|
||||
axis: toplevel_parent_container(&*window)
|
||||
.map(|c| c.split.get())
|
||||
.unwrap_or(ContainerSplit::Horizontal)
|
||||
.into(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_window_split(&self, window: Window, axis: Axis) -> Result<(), CphError> {
|
||||
self.state.with_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
if let Some(c) = toplevel_parent_container(&*window) {
|
||||
c.set_split(axis.into());
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn handle_add_shortcut(
|
||||
&self,
|
||||
seat: Seat,
|
||||
|
|
@ -916,12 +825,6 @@ impl ConfigProxyHandler {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_create_window_split(&self, window: Window, axis: Axis) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
toplevel_create_split(&self.state, window, axis.into());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_focus_seat_parent(&self, seat: Seat) -> Result<(), CphError> {
|
||||
let seat = self.get_seat(seat)?;
|
||||
seat.focus_parent();
|
||||
|
|
@ -953,22 +856,6 @@ impl ConfigProxyHandler {
|
|||
})
|
||||
}
|
||||
|
||||
fn handle_get_window_floating(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowFloating {
|
||||
floating: window.tl_data().parent_is_float.get(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_set_window_floating(&self, window: Window, floating: bool) -> Result<(), CphError> {
|
||||
self.state.with_linear_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
toplevel_set_floating(&self.state, window, floating);
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn handle_set_pointer_revert_key(&self, seat: Seat, key: KeySym) -> Result<(), CphError> {
|
||||
self.get_seat(seat)?.set_pointer_revert_key(key);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -197,4 +197,147 @@ impl ConfigProxyHandler {
|
|||
self.respond(Response::GetWindowChildren { windows });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_window_close(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
window.tl_close();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_window_move(
|
||||
&self,
|
||||
window: Window,
|
||||
direction: Direction,
|
||||
) -> Result<(), CphError> {
|
||||
self.state.with_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
if let Some(float) = window.tl_data().float.get() {
|
||||
float.move_by_direction(direction.into());
|
||||
} else if let Some(c) = toplevel_parent_container(&*window) {
|
||||
c.move_child(window, direction.into());
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn handle_get_window_fullscreen(
|
||||
&self,
|
||||
window: Window,
|
||||
) -> Result<(), CphError> {
|
||||
let tl = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowFullscreen {
|
||||
fullscreen: tl.tl_data().is_fullscreen.get(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_set_window_fullscreen(
|
||||
&self,
|
||||
window: Window,
|
||||
fullscreen: bool,
|
||||
) -> Result<(), CphError> {
|
||||
let tl = self.get_window(window)?;
|
||||
tl.tl_set_fullscreen(fullscreen, None);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_get_window_float_pinned(
|
||||
&self,
|
||||
window: Window,
|
||||
) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowFloatPinned {
|
||||
pinned: window.tl_pinned(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_set_window_float_pinned(
|
||||
&self,
|
||||
window: Window,
|
||||
pinned: bool,
|
||||
) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
window.tl_set_pinned(true, pinned);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_get_window_mono(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowMono {
|
||||
mono: toplevel_parent_container(&*window)
|
||||
.map(|c| c.mono_child.is_some())
|
||||
.unwrap_or(false),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_set_window_mono(
|
||||
&self,
|
||||
window: Window,
|
||||
mono: bool,
|
||||
) -> Result<(), CphError> {
|
||||
self.state.with_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
if let Some(c) = toplevel_parent_container(&*window) {
|
||||
c.set_mono(mono.then_some(window.as_ref()));
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn handle_get_window_split(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowSplit {
|
||||
axis: toplevel_parent_container(&*window)
|
||||
.map(|c| c.split.get())
|
||||
.unwrap_or(ContainerSplit::Horizontal)
|
||||
.into(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_set_window_split(
|
||||
&self,
|
||||
window: Window,
|
||||
axis: Axis,
|
||||
) -> Result<(), CphError> {
|
||||
self.state.with_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
if let Some(c) = toplevel_parent_container(&*window) {
|
||||
c.set_split(axis.into());
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn handle_create_window_split(
|
||||
&self,
|
||||
window: Window,
|
||||
axis: Axis,
|
||||
) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
toplevel_create_split(&self.state, window, axis.into());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_get_window_floating(&self, window: Window) -> Result<(), CphError> {
|
||||
let window = self.get_window(window)?;
|
||||
self.respond(Response::GetWindowFloating {
|
||||
floating: window.tl_data().parent_is_float.get(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_set_window_floating(
|
||||
&self,
|
||||
window: Window,
|
||||
floating: bool,
|
||||
) -> Result<(), CphError> {
|
||||
self.state.with_linear_layout_animations(|| {
|
||||
let window = self.get_window(window)?;
|
||||
toplevel_set_floating(&self.state, window, floating);
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue