X11: Disable maximize on non-resizable windows (#1000)

* X11: Disable maximize on non-resizable windows

* Add a note for the source for Motif WM constants
This commit is contained in:
Murarth 2019-07-04 03:43:44 -07:00 committed by Hal Gentz
parent f8bd671073
commit 9393b14b01
3 changed files with 131 additions and 16 deletions

View file

@ -667,20 +667,11 @@ impl UnownedWindow {
}
fn set_decorations_inner(&self, decorations: bool) -> util::Flusher<'_> {
let wm_hints = unsafe { self.xconn.get_atom_unchecked(b"_MOTIF_WM_HINTS\0") };
self.xconn.change_property(
self.xwindow,
wm_hints,
wm_hints,
util::PropMode::Replace,
&[
util::MWM_HINTS_DECORATIONS, // flags
0, // functions
decorations as c_ulong, // decorations
0, // input mode
0, // status
],
)
let mut hints = self.xconn.get_motif_hints(self.xwindow);
hints.set_decorations(decorations);
self.xconn.set_motif_hints(self.xwindow, &hints)
}
#[inline]
@ -691,6 +682,14 @@ impl UnownedWindow {
self.invalidate_cached_frame_extents();
}
fn set_maximizable_inner(&self, maximizable: bool) -> util::Flusher<'_> {
let mut hints = self.xconn.get_motif_hints(self.xwindow);
hints.set_maximizable(maximizable);
self.xconn.set_motif_hints(self.xwindow, &hints)
}
fn set_always_on_top_inner(&self, always_on_top: bool) -> util::Flusher<'_> {
let above_atom = unsafe { self.xconn.get_atom_unchecked(b"_NET_WM_STATE_ABOVE\0") };
self.set_netwm(always_on_top.into(), (above_atom as c_long, 0, 0, 0))
@ -985,6 +984,8 @@ impl UnownedWindow {
(window_size.clone(), window_size)
};
self.set_maximizable_inner(resizable).queue();
let dpi_factor = self.hidpi_factor();
let min_inner_size = logical_min
.map(|logical_size| logical_size.to_physical(dpi_factor))