|
14 | 14 | //! * `wayland-csd-adwaita-crossfont`.
|
15 | 15 | //! * `wayland-csd-adwaita-notitle`.
|
16 | 16 | #[cfg(wayland_platform)]
|
17 |
| -use sctk::shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer}; |
| 17 | +pub use sctk::{ |
| 18 | + compositor::Region, |
| 19 | + shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer}, |
| 20 | +}; |
18 | 21 |
|
19 | 22 | use crate::dpi::{LogicalPosition, LogicalSize};
|
| 23 | +use crate::error::RequestError; |
20 | 24 | use crate::event_loop::{ActiveEventLoop, EventLoop, EventLoopBuilder};
|
21 | 25 | use crate::monitor::MonitorHandle;
|
22 | 26 | pub use crate::window::Theme;
|
@@ -78,11 +82,27 @@ impl EventLoopBuilderExtWayland for EventLoopBuilder {
|
78 | 82 | ///
|
79 | 83 | /// [`Window`]: crate::window::Window
|
80 | 84 | pub trait WindowExtWayland {
|
81 |
| - fn set_region(&self, region: Option<(LogicalPosition<i32>, LogicalSize<i32>)>); |
| 85 | + fn create_region( |
| 86 | + &self, |
| 87 | + position: LogicalPosition<i32>, |
| 88 | + size: LogicalSize<i32>, |
| 89 | + ) -> Result<Region, RequestError>; |
| 90 | + fn set_region(&self, region: Option<&Region>); |
82 | 91 | }
|
83 | 92 |
|
84 | 93 | impl WindowExtWayland for dyn CoreWindow + '_ {
|
85 |
| - fn set_region(&self, region: Option<(LogicalPosition<i32>, LogicalSize<i32>)>) { |
| 94 | + fn create_region( |
| 95 | + &self, |
| 96 | + pos: LogicalPosition<i32>, |
| 97 | + size: LogicalSize<i32>, |
| 98 | + ) -> Result<Region, RequestError> { |
| 99 | + let window = self.as_any().downcast_ref::<crate::platform_impl::wayland::Window>().unwrap(); |
| 100 | + let region = window.create_region()?; |
| 101 | + region.add(pos.x, pos.y, size.width, size.height); |
| 102 | + Ok(region) |
| 103 | + } |
| 104 | + |
| 105 | + fn set_region(&self, region: Option<&Region>) { |
86 | 106 | let window = self.as_any().downcast_ref::<crate::platform_impl::wayland::Window>().unwrap();
|
87 | 107 | window.set_region(region);
|
88 | 108 | }
|
|
0 commit comments