diff --git a/src/os/unix/x11.rs b/src/os/unix/x11.rs index f6d59f7..a940bcb 100644 --- a/src/os/unix/x11.rs +++ b/src/os/unix/x11.rs @@ -14,7 +14,7 @@ use crate::{CursorStyle, MenuHandle, UnixMenu}; use std::ffi::CString; use std::mem; use std::os::raw; -use std::os::raw::{c_char, c_uint}; +use std::os::raw::{c_char, c_long, c_uchar, c_uint, c_ulong}; use std::ptr; use crate::buffer_helper; @@ -73,6 +73,15 @@ extern "C" { ); } +#[repr(C)] +struct MwmHints { + flags: c_ulong, + functions: c_ulong, + decorations: c_ulong, + input_mode: c_long, + status: c_ulong, +} + struct DisplayInfo { lib: x11_dl::xlib::Xlib, display: *mut xlib::Display, @@ -384,6 +393,25 @@ impl Window { ); } + if opts.borderless { + let hints_property = + (d.lib.XInternAtom)(d.display, "_MOTIF_WM_HINTS\0" as *const _ as *const i8, 0); + assert!(hints_property != 0); + let mut hints: MwmHints = std::mem::zeroed(); + hints.flags = 2; + hints.decorations = 0; + (d.lib.XChangeProperty)( + d.display, + handle, + hints_property, + hints_property, + 32, + xlib::PropModeReplace, + &hints as *const _ as *const c_uchar, + 5, + ); + } + (d.lib.XClearWindow)(d.display, handle); (d.lib.XMapRaised)(d.display, handle); (d.lib.XSetWMProtocols)(d.display, handle, &mut d.wm_delete_window, 1);