On Wayland, handle none decorations
During the migration some logic wrt `none` decorations was lost along the way, however we also now try to ask for client side decorations if the user wants to disable server side decorations. Fixes #2902.
This commit is contained in:
parent
bc216b8f67
commit
059abb06fc
2 changed files with 43 additions and 7 deletions
|
|
@ -113,6 +113,9 @@ pub struct WindowState {
|
|||
/// Whether the CSD fail to create, so we don't try to create them on each iteration.
|
||||
csd_fails: bool,
|
||||
|
||||
/// Whether we should decorate the frame.
|
||||
decorate: bool,
|
||||
|
||||
/// Min size.
|
||||
min_inner_size: LogicalSize<u32>,
|
||||
max_inner_size: Option<LogicalSize<u32>>,
|
||||
|
|
@ -180,8 +183,8 @@ impl WindowState {
|
|||
) {
|
||||
Ok(mut frame) => {
|
||||
frame.set_title(&self.title);
|
||||
// Ensure that the frame is not hidden.
|
||||
frame.set_hidden(false);
|
||||
// Hide the frame if we were asked to not decorate.
|
||||
frame.set_hidden(!self.decorate);
|
||||
self.frame = Some(frame);
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
@ -391,6 +394,7 @@ impl WindowState {
|
|||
connection,
|
||||
theme,
|
||||
csd_fails: false,
|
||||
decorate: true,
|
||||
cursor_grab_mode: GrabState::new(),
|
||||
cursor_icon: CursorIcon::Default,
|
||||
cursor_visible: true,
|
||||
|
|
@ -706,6 +710,28 @@ impl WindowState {
|
|||
/// Whether show or hide client side decorations.
|
||||
#[inline]
|
||||
pub fn set_decorate(&mut self, decorate: bool) {
|
||||
if decorate == self.decorate {
|
||||
return;
|
||||
}
|
||||
|
||||
self.decorate = decorate;
|
||||
|
||||
match self
|
||||
.last_configure
|
||||
.as_ref()
|
||||
.map(|configure| configure.decoration_mode)
|
||||
{
|
||||
Some(DecorationMode::Server) if !self.decorate => {
|
||||
// To disable decorations we should request client and hide the frame.
|
||||
self.window
|
||||
.request_decoration_mode(Some(DecorationMode::Client))
|
||||
}
|
||||
_ if self.decorate => self
|
||||
.window
|
||||
.request_decoration_mode(Some(DecorationMode::Server)),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
if let Some(frame) = self.frame.as_mut() {
|
||||
frame.set_hidden(!decorate);
|
||||
// Force the resize.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue