Add window::monitor_size task

This commit is contained in:
rhysd 2025-01-27 03:33:03 +09:00 committed by Héctor Ramón Jiménez
parent 5195a59e20
commit d7d8b67cdc
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 23 additions and 1 deletions

View file

@ -175,6 +175,9 @@ pub enum Action {
/// Set the window size increment.
SetResizeIncrements(Id, Option<Size>),
/// Get the size of the monitor on which the window currently resides in logical dimensions.
GetMonitorSize(Id, oneshot::Sender<Option<Size>>),
/// Redraws all the windows.
RedrawAll,
@ -491,3 +494,10 @@ pub fn enable_mouse_passthrough<Message>(id: Id) -> Task<Message> {
pub fn disable_mouse_passthrough<Message>(id: Id) -> Task<Message> {
task::effect(crate::Action::Window(Action::DisableMousePassthrough(id)))
}
/// Get the size of the monitor on which the window currently resides in logical dimensions.
pub fn monitor_size(id: Id) -> Task<Option<Size>> {
task::oneshot(move |channel| {
crate::Action::Window(Action::GetMonitorSize(id, channel))
})
}