fn can_kill_window_gracefully(_wm: &mut WindowManager, _w: xlib::Window) -> bool {
    let mut atoms: *mut xlib::Atom = unsafe { uninitialized() };
    let mut atom_count: i32 = 0;

    let result = unsafe { xlib::XGetWMProtocols(_wm.display, _w, &mut atoms, &mut atom_count) };

    if result == 0 {
        return false;
    }

    let wm_delete_window_str = CString::new("WM_DELETE_WINDOW").unwrap();
    let delete_atom =
        unsafe { xlib::XInternAtom(_wm.display, wm_delete_window_str.as_ptr(), xlib::False) };

    // FIXME There must be an alternative for a loop
    for _i in 0..atom_count {
        let v = unsafe { atoms.offset(_i as isize) };
        if unsafe { *v == delete_atom } {
            return true;
        }
    }

    return false;
}
/**
 * Checks if a window can be gracefully killed
 */
Checks if a window can be gracefully killed
Checks if a window can be gracefully killed
fn can_kill_window_gracefully(_wm: &mut WindowManager, _w: xlib::Window) -> bool {
    let mut atoms: *mut xlib::Atom = unsafe { uninitialized() };
    let mut atom_count: i32 = 0;
    let result = unsafe { xlib::XGetWMProtocols(_wm.display, _w, &mut atoms, &mut atom_count) };
    if result == 0 {
        return false;
    }
    let wm_delete_window_str = CString::new("WM_DELETE_WINDOW").unwrap();
    let delete_atom =
        unsafe { xlib::XInternAtom(_wm.display, wm_delete_window_str.as_ptr(), xlib::False) };
    // FIXME There must be an alternative for a loop
    for _i in 0..atom_count {
        let v = unsafe { atoms.offset(_i as isize) };
        if unsafe { *v == delete_atom } {
            return true;
        }
    }
    return false;
}
fn can_kill_window_gracefully ( _wm : & mut WindowManager , _w : xlib :: Window ) -> bool { let mut atoms : * mut xlib :: Atom = unsafe { uninitialized ( ) } ; let mut atom_count : i32 = 0 ; let result = unsafe { xlib :: XGetWMProtocols ( _wm . display , _w , & mut atoms , & mut atom_count ) } ; if result == 0 { return false ; } let wm_delete_window_str = CString :: new ( " " ) . unwrap ( ) ; let delete_atom = unsafe { xlib :: XInternAtom ( _wm . display , wm_delete_window_str . as_ptr ( ) , xlib :: False ) } ; // FIXME There must be an alternative for a loop for _i in 0 .. atom_count { let v = unsafe { atoms . offset ( _i as isize ) } ; if unsafe { * v == delete_atom } { return true ; } } return false ; }
Checks if a window can be gracefully killed
Checks if a window can be gracefully killed
_wm
&mut WindowManager
_w
xlib::Window
_wm
&mut WindowManager
_w
xlib::Window