Fix: Check for remaining events in the internal X11/xcb buffers (#86)
* Fix: Check for remaining events in the internal X11/xcb buffers before going to sleep. * Also need to set the queue owner to xcb as wrl suggested.
This commit is contained in:
parent
68a5c4a19f
commit
50c41755fd
|
@ -283,6 +283,10 @@ impl Window {
|
|||
|
||||
let mut fds = [PollFd::new(xcb_fd, PollFlags::POLLIN)];
|
||||
|
||||
// Check for any events in the internal buffers
|
||||
// before going to sleep:
|
||||
self.drain_xcb_events(handler);
|
||||
|
||||
// FIXME: handle errors
|
||||
poll(&mut fds, until_next_frame.subsec_millis() as i32).unwrap();
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ impl XcbConnection {
|
|||
pub fn new() -> Result<Self, xcb::base::ConnError> {
|
||||
let (conn, xlib_display) = xcb::Connection::connect_with_xlib_display()?;
|
||||
|
||||
conn.set_event_queue_owner(xcb::base::EventQueueOwner::Xcb);
|
||||
|
||||
let (wm_protocols, wm_delete_window, wm_normal_hints) = intern_atoms!(&conn, WM_PROTOCOLS, WM_DELETE_WINDOW, WM_NORMAL_HINTS);
|
||||
|
||||
Ok(Self {
|
||||
|
|
Loading…
Reference in a new issue