Skip to content

Commit

Permalink
Add is_resizable and is_decorated on Wayland
Browse files Browse the repository at this point in the history
This commit brings `is_resizable` and `is_decorated`. Since the client
is responsible for both of them, they could be tracked without deep
syncing with server.
  • Loading branch information
kchibisov authored Apr 7, 2022
1 parent ab1f636 commit e8d910f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/platform_impl/linux/wayland/window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ pub struct Window {

/// Requests that SCTK window should perform.
window_requests: Arc<Mutex<Vec<WindowRequest>>>,

/// Whether the window is resizeable.
resizeable: AtomicBool,

/// Whether the window is decorated.
decorated: AtomicBool,
}

impl Window {
Expand Down Expand Up @@ -248,6 +254,8 @@ impl Window {
fullscreen,
maximized,
windowing_features,
resizeable: AtomicBool::new(attributes.resizable),
decorated: AtomicBool::new(attributes.decorations),
};

Ok(window)
Expand Down Expand Up @@ -338,12 +346,13 @@ impl Window {

#[inline]
pub fn set_resizable(&self, resizable: bool) {
self.resizeable.store(resizable, Ordering::Relaxed);
self.send_request(WindowRequest::Resizeable(resizable));
}

#[inline]
pub fn is_resizable(&self) -> bool {
true
self.resizeable.load(Ordering::Relaxed)
}

#[inline]
Expand All @@ -355,12 +364,13 @@ impl Window {

#[inline]
pub fn set_decorations(&self, decorate: bool) {
self.decorated.store(decorate, Ordering::Relaxed);
self.send_request(WindowRequest::Decorate(decorate));
}

#[inline]
pub fn is_decorated(&self) -> bool {
true
self.decorated.load(Ordering::Relaxed)
}

#[inline]
Expand Down
4 changes: 2 additions & 2 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ impl Window {
///
/// ## Platform-specific
///
/// - **Wayland / X11:** Not implemented.
/// - **X11:** Not implemented.
/// - **iOS / Android / Web:** Unsupported.
#[inline]
pub fn is_resizable(&self) -> bool {
Expand Down Expand Up @@ -777,7 +777,7 @@ impl Window {
///
/// ## Platform-specific
///
/// - **Wayland / X11:** Not implemented.
/// - **X11:** Not implemented.
/// - **iOS / Android / Web:** Unsupported.
#[inline]
pub fn is_decorated(&self) -> bool {
Expand Down

0 comments on commit e8d910f

Please sign in to comment.