As the comment describes, nextEventMatchingMask:untilDate:inMode:dequeue: blocks during a resize and does not return events until the resize is complete. That includes not returning events sent via postEvent:atStart:, which means Proxy::wakeup() doesn't actually cause run_forever() to wake up.
This property is especially unfortunate with glutin_window, which implements its own fn wait_event_timeout(&mut self, timeout: Duration) by calling run_forever() and interrupting when the timeout expires. Since it can't interrupt, a wait_event_timeout() that wants to yield 60 fps to e.g. drive a render loop will simply hang entirely until the user is done resizing.
I've been experimenting with ways to get nextEventMatchingMask: to be less thorny, but another complimentary approach would be to expose a new run_until_timeout() call in addition to poll_events() and run_forever() -- or perhaps to deprecate poll_events() and run_forever() in favor of run_until_timeout(Some(0)) and run_until_timeout(None). A timeout-aware API would let glutin_window pass its deadline all the way down to nextEventMatchingMask:untilDate:, avoid spawning needless timeout threads, and sidestep some of the resize-related blocking issues all at once.
As the comment describes,
nextEventMatchingMask:untilDate:inMode:dequeue:blocks during a resize and does not return events until the resize is complete. That includes not returning events sent viapostEvent:atStart:, which meansProxy::wakeup()doesn't actually causerun_forever()to wake up.This property is especially unfortunate with
glutin_window, which implements its ownfn wait_event_timeout(&mut self, timeout: Duration)by callingrun_forever()and interrupting when the timeout expires. Since it can't interrupt, await_event_timeout()that wants to yield 60 fps to e.g. drive a render loop will simply hang entirely until the user is done resizing.I've been experimenting with ways to get
nextEventMatchingMask:to be less thorny, but another complimentary approach would be to expose a newrun_until_timeout()call in addition topoll_events()andrun_forever()-- or perhaps to deprecatepoll_events()andrun_forever()in favor ofrun_until_timeout(Some(0))andrun_until_timeout(None). A timeout-aware API would letglutin_windowpass its deadline all the way down tonextEventMatchingMask:untilDate:, avoid spawning needless timeout threads, and sidestep some of the resize-related blocking issues all at once.