Skip to content
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

Consume all events in the event queue to avoid application lockups #300

Merged
merged 1 commit into from
Oct 31, 2018
Merged

Consume all events in the event queue to avoid application lockups #300

merged 1 commit into from
Oct 31, 2018

Conversation

guillep
Copy link
Contributor

@guillep guillep commented Oct 31, 2018

It seems that "peeking" from the event queue does not yield events in case of changing resolutions:

NSApp nextEventMatchingMask:NSEventMaskAny
                             untilDate:nil
                             inMode:NSEventTrackingRunLoopMode
                             dequeue: ***NO***

And then it never enters the loop...

Of course, apple's doc says nothing about this: https://developer.apple.com/documentation/appkit/nsapplication/1428485-nexteventmatchingmask?language=objc
So all this is speculation ^^.

This new version consumes all pending events in the NSApp, and it does not show any lockups when e.g., switching resolutions. If the event does not correspond to this window, we take it from the event queue anyways and re-post it afterwards, to give other windows the opportunity to consume their events.

@eliotmiranda eliotmiranda merged commit 6fee3a7 into OpenSmalltalk:Cog Oct 31, 2018
@guillep guillep deleted the fix/osx/events branch November 1, 2018 18:18
fniephaus added a commit that referenced this pull request Mar 2, 2020
@guillep introduced some additional logic to filter out events that do not correspond to the VM window. The about panel and the fullscreen frame are also alien windows, but were not receiving any events because of this change. As a consequence, these events will forever remain in the queue and therefore, the buttons of the fullscreen frame and about panel cannot be clicked.
This commit reverts all changes back to the previous version that consumes all events and forwards them to NSApp.
In order to avoid breaking PharoVM, we do all of this behind an `#ifdef PharoVM`.

Relevant changes:
#295
#300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants