Add remaining window methods

This commit is contained in:
Ottatop 2023-10-19 20:00:46 -05:00
parent f54f73b105
commit 87574a40e3

View file

@ -1,6 +1,8 @@
use crate::{ use crate::{
msg::{FullscreenOrMaximized, Msg, Request, RequestResponse, WindowId}, msg::{FullscreenOrMaximized, Msg, Request, RequestResponse, WindowId},
request, send_msg, request, send_msg,
tag::TagHandle,
MouseButton,
}; };
pub struct Window; pub struct Window;
@ -23,6 +25,22 @@ impl Window {
window_ids.into_iter().map(WindowHandle) window_ids.into_iter().map(WindowHandle)
} }
pub fn begin_move(&self, button: MouseButton) {
let msg = Msg::WindowMoveGrab {
button: button as u32,
};
send_msg(msg).unwrap();
}
pub fn begin_resize(&self, button: MouseButton) {
let msg = Msg::WindowResizeGrab {
button: button as u32,
};
send_msg(msg).unwrap();
}
} }
pub struct WindowHandle(WindowId); pub struct WindowHandle(WindowId);
@ -88,4 +106,22 @@ impl WindowHandle {
fullscreen_or_maximized, fullscreen_or_maximized,
} }
} }
pub fn toggle_tag(&self, tag: &TagHandle) {
let msg = Msg::ToggleTagOnWindow {
window_id: self.0,
tag_id: tag.0,
};
send_msg(msg).unwrap();
}
pub fn move_to_tag(&self, tag: &TagHandle) {
let msg = Msg::MoveWindowToTag {
window_id: self.0,
tag_id: tag.0,
};
send_msg(msg).unwrap();
}
} }