chore(wayland): window state handling
This commit is contained in:
parent
e73bbddbca
commit
bc85d82426
4 changed files with 18 additions and 1 deletions
|
|
@ -1,8 +1,12 @@
|
|||
#![allow(missing_docs)]
|
||||
|
||||
use cctk::sctk::reexports::csd_frame::WindowState;
|
||||
|
||||
/// window events
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum WindowEvent {
|
||||
/// Window suggested bounds.
|
||||
SuggestedBounds(Option<crate::Size>),
|
||||
/// Window state
|
||||
WindowState(WindowState),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ pub fn window_event(
|
|||
event: winit::event::WindowEvent,
|
||||
scale_factor: f64,
|
||||
modifiers: winit::keyboard::ModifiersState,
|
||||
window: &dyn winit::window::Window,
|
||||
) -> Option<Event> {
|
||||
use winit::event::Ime;
|
||||
use winit::event::WindowEvent;
|
||||
|
|
@ -436,7 +437,18 @@ pub fn window_event(
|
|||
),
|
||||
)))
|
||||
}
|
||||
#[cfg(feature = "wayland")]
|
||||
WindowEvent::WindowStateChanged => {
|
||||
use cctk::sctk::reexports::csd_frame::WindowState;
|
||||
use winit::platform::wayland::WindowExtWayland;
|
||||
|
||||
let s = window.window_state();
|
||||
Some(Event::PlatformSpecific(iced_futures::core::event::PlatformSpecific::Wayland(
|
||||
iced_runtime::core::event::wayland::Event::Window(
|
||||
iced_runtime::core::event::wayland::WindowEvent::WindowState(s.unwrap_or(WindowState::empty()))
|
||||
),
|
||||
)))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1283,6 +1283,7 @@ async fn run_instance<P>(
|
|||
event,
|
||||
window.state.scale_factor(),
|
||||
window.state.modifiers(),
|
||||
window.raw.as_ref(),
|
||||
) {
|
||||
events.push((Some(id), event));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use iced_futures::core::{border::Radius, window};
|
||||
use iced_futures::core::window;
|
||||
use iced_runtime::{
|
||||
self,
|
||||
platform_specific::{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue