x11: Implement file drag and drop (#360)

* x11: Implement file drag and drop

* Fixed typo
This commit is contained in:
Francesca Sunshine 2017-12-13 06:22:03 -05:00 committed by Pierre Krieger
parent d2dd82c146
commit d18db208ff
7 changed files with 498 additions and 18 deletions

View file

@ -125,6 +125,24 @@ impl Window2 {
win
};
// Enable drag and drop
unsafe {
let atom_name: *const libc::c_char = b"XdndAware\0".as_ptr() as _;
let atom = (display.xlib.XInternAtom)(display.display, atom_name, ffi::False);
let version = &5; // Latest version; hasn't changed since 2002
(display.xlib.XChangeProperty)(
display.display,
window,
atom,
ffi::XA_ATOM,
32,
ffi::PropModeReplace,
version,
1
);
display.check_errors().expect("Failed to set drag and drop properties");
}
// Set ICCCM WM_CLASS property based on initial window title
// Must be done *before* mapping the window by ICCCM 4.1.2.5
unsafe {