* Allow using multiple `XWindowType`s on X11 (#1140) * Update documentation to make combining window types clearer * Update build flags because X11 runs on more than just Linux * Revert "Update build flags because X11 runs on more than just Linux" This reverts commit 882b9100462a5ee0cf89dcd42891ebd0f709964f. * Revert "Update documentation to make combining window types clearer" This reverts commit da00ad391a8ce42cea08b577b216316b013f9e36. * Revert "Allow using multiple `XWindowType`s on X11 (#1140)" This reverts commit a23033345697463400286c4d297f5c1552369fc2. * Allow using multiple `XWindowType`s on X11 (slice variant) (#1140) * Multiple `XWindowType`s, with non-static lifetime. * Multiple `XWindowType`s (#1140) (`Vec` variant) * Append change to changelog. * Fix formatting.
This commit is contained in:
parent
2ef39651eb
commit
c0a7900341
6 changed files with 96 additions and 74 deletions
|
|
@ -72,21 +72,21 @@ impl Default for WindowType {
|
|||
impl WindowType {
|
||||
pub(crate) fn as_atom(&self, xconn: &Arc<XConnection>) -> ffi::Atom {
|
||||
use self::WindowType::*;
|
||||
let atom_name: &[u8] = match self {
|
||||
&Desktop => b"_NET_WM_WINDOW_TYPE_DESKTOP\0",
|
||||
&Dock => b"_NET_WM_WINDOW_TYPE_DOCK\0",
|
||||
&Toolbar => b"_NET_WM_WINDOW_TYPE_TOOLBAR\0",
|
||||
&Menu => b"_NET_WM_WINDOW_TYPE_MENU\0",
|
||||
&Utility => b"_NET_WM_WINDOW_TYPE_UTILITY\0",
|
||||
&Splash => b"_NET_WM_WINDOW_TYPE_SPLASH\0",
|
||||
&Dialog => b"_NET_WM_WINDOW_TYPE_DIALOG\0",
|
||||
&DropdownMenu => b"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0",
|
||||
&PopupMenu => b"_NET_WM_WINDOW_TYPE_POPUP_MENU\0",
|
||||
&Tooltip => b"_NET_WM_WINDOW_TYPE_TOOLTIP\0",
|
||||
&Notification => b"_NET_WM_WINDOW_TYPE_NOTIFICATION\0",
|
||||
&Combo => b"_NET_WM_WINDOW_TYPE_COMBO\0",
|
||||
&Dnd => b"_NET_WM_WINDOW_TYPE_DND\0",
|
||||
&Normal => b"_NET_WM_WINDOW_TYPE_NORMAL\0",
|
||||
let atom_name: &[u8] = match *self {
|
||||
Desktop => b"_NET_WM_WINDOW_TYPE_DESKTOP\0",
|
||||
Dock => b"_NET_WM_WINDOW_TYPE_DOCK\0",
|
||||
Toolbar => b"_NET_WM_WINDOW_TYPE_TOOLBAR\0",
|
||||
Menu => b"_NET_WM_WINDOW_TYPE_MENU\0",
|
||||
Utility => b"_NET_WM_WINDOW_TYPE_UTILITY\0",
|
||||
Splash => b"_NET_WM_WINDOW_TYPE_SPLASH\0",
|
||||
Dialog => b"_NET_WM_WINDOW_TYPE_DIALOG\0",
|
||||
DropdownMenu => b"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0",
|
||||
PopupMenu => b"_NET_WM_WINDOW_TYPE_POPUP_MENU\0",
|
||||
Tooltip => b"_NET_WM_WINDOW_TYPE_TOOLTIP\0",
|
||||
Notification => b"_NET_WM_WINDOW_TYPE_NOTIFICATION\0",
|
||||
Combo => b"_NET_WM_WINDOW_TYPE_COMBO\0",
|
||||
Dnd => b"_NET_WM_WINDOW_TYPE_DND\0",
|
||||
Normal => b"_NET_WM_WINDOW_TYPE_NORMAL\0",
|
||||
};
|
||||
unsafe { xconn.get_atom_unchecked(atom_name) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,9 +298,7 @@ impl UnownedWindow {
|
|||
|
||||
window.set_pid().map(|flusher| flusher.queue());
|
||||
|
||||
if pl_attribs.x11_window_type != Default::default() {
|
||||
window.set_window_type(pl_attribs.x11_window_type).queue();
|
||||
}
|
||||
window.set_window_types(pl_attribs.x11_window_types).queue();
|
||||
|
||||
if let Some(variant) = pl_attribs.gtk_theme_variant {
|
||||
window.set_gtk_theme_variant(variant).queue();
|
||||
|
|
@ -483,15 +481,19 @@ impl UnownedWindow {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_window_type(&self, window_type: util::WindowType) -> util::Flusher<'_> {
|
||||
fn set_window_types(&self, window_types: Vec<util::WindowType>) -> util::Flusher<'_> {
|
||||
let hint_atom = unsafe { self.xconn.get_atom_unchecked(b"_NET_WM_WINDOW_TYPE\0") };
|
||||
let window_type_atom = window_type.as_atom(&self.xconn);
|
||||
let atoms: Vec<_> = window_types
|
||||
.iter()
|
||||
.map(|t| t.as_atom(&self.xconn))
|
||||
.collect();
|
||||
|
||||
self.xconn.change_property(
|
||||
self.xwindow,
|
||||
hint_atom,
|
||||
ffi::XA_ATOM,
|
||||
util::PropMode::Replace,
|
||||
&[window_type_atom],
|
||||
&atoms,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue