1
0
Fork 0

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:
Weird Constructor 2021-03-04 18:00:42 +01:00 committed by GitHub
parent 68a5c4a19f
commit 50c41755fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -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();

View file

@ -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 {