Implement _NET_WM_PING for X11 (#977)
This commit is contained in:
parent
dd38fab2f3
commit
23354cf1a5
4 changed files with 18 additions and 2 deletions
|
|
@ -131,6 +131,16 @@ impl<T: 'static> EventProcessor<T> {
|
|||
window_id,
|
||||
event: WindowEvent::CloseRequested,
|
||||
});
|
||||
} else if client_msg.data.get_long(0) as ffi::Atom == wt.net_wm_ping {
|
||||
let response_msg: &mut ffi::XClientMessageEvent = xev.as_mut();
|
||||
response_msg.window = wt.root;
|
||||
wt.xconn
|
||||
.send_event(
|
||||
wt.root,
|
||||
Some(ffi::SubstructureNotifyMask | ffi::SubstructureRedirectMask),
|
||||
*response_msg,
|
||||
)
|
||||
.queue();
|
||||
} else if client_msg.message_type == self.dnd.atoms.enter {
|
||||
let source_window = client_msg.data.get_long(0) as c_ulong;
|
||||
let flags = client_msg.data.get_long(1);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ use crate::{
|
|||
pub struct EventLoopWindowTarget<T> {
|
||||
xconn: Arc<XConnection>,
|
||||
wm_delete_window: ffi::Atom,
|
||||
net_wm_ping: ffi::Atom,
|
||||
ime_sender: ImeSender,
|
||||
root: ffi::Window,
|
||||
ime: RefCell<Ime>,
|
||||
|
|
@ -75,6 +76,8 @@ impl<T: 'static> EventLoop<T> {
|
|||
|
||||
let wm_delete_window = unsafe { xconn.get_atom_unchecked(b"WM_DELETE_WINDOW\0") };
|
||||
|
||||
let net_wm_ping = unsafe { xconn.get_atom_unchecked(b"_NET_WM_PING\0") };
|
||||
|
||||
let dnd = Dnd::new(Arc::clone(&xconn))
|
||||
.expect("Failed to call XInternAtoms when initializing drag and drop");
|
||||
|
||||
|
|
@ -142,6 +145,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
ime_sender,
|
||||
xconn,
|
||||
wm_delete_window,
|
||||
net_wm_ping,
|
||||
pending_redraws: Default::default(),
|
||||
}),
|
||||
_marker: ::std::marker::PhantomData,
|
||||
|
|
|
|||
|
|
@ -330,8 +330,9 @@ impl UnownedWindow {
|
|||
(xconn.xlib.XSetWMProtocols)(
|
||||
xconn.display,
|
||||
window.xwindow,
|
||||
&event_loop.wm_delete_window as *const ffi::Atom as *mut ffi::Atom,
|
||||
1,
|
||||
&[event_loop.wm_delete_window, event_loop.net_wm_ping] as *const ffi::Atom
|
||||
as *mut ffi::Atom,
|
||||
2,
|
||||
);
|
||||
} //.queue();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue