-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wayland: ensure external loop is notified with pump_events #4185
base: master
Are you sure you want to change the base?
wayland: ensure external loop is notified with pump_events #4185
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested it.
if let Some(pump_event_notifier) = self.pump_event_notifier.as_ref() { | ||
// Notify that we should start waiting, since we're in winit. | ||
*pump_event_notifier.control.0.lock().unwrap() = true; | ||
pump_event_notifier.control.1.notify_one(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if let Some(pump_event_notifier) = self.pump_event_notifier.as_ref() { | |
// Notify that we should start waiting, since we're in winit. | |
*pump_event_notifier.control.0.lock().unwrap() = true; | |
pump_event_notifier.control.1.notify_one(); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that is redundant, though, I left for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't wake up the thread before having dispatched all messages since it will just immediately trigger a notification again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would have been blocked in read_events
, otherwise we'd had events to read and thus wake-up would have been needed anyway. But yeah should be fine.
let mut source = wayland_dispatcher.as_source_mut(); | ||
let _ = winit_state.dispatch_pending(source.queue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's necessary. The dispatch isn't done otherwise IIRC, but I can test one more time though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't pump_app_events
always dispatch events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's required. I think it's a bug though, should be fixed on calloop
end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested it.
} | ||
|
||
if let Some(read_guard) = connection.prepare_read() { | ||
let _ = connection.flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a loop with polling until flush returns Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs should likely mention that, but I've never seen a wayland loop that flush
in a loop until it works. I'd also assume that it may fail in a non-recoverable way.
_handle: JoinHandle<()>, | ||
} | ||
|
||
fn spawn_wakeup_thread( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thread needs to be shut down at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I just put it as a draft for now due to that.
69201e9
to
b8f2792
Compare
b8f2792
to
20ef834
Compare
I think now it should work, though, I'll need a patch for |
20ef834
to
6011e7b
Compare
6011e7b
to
a2629e8
Compare
Fixes #4183.