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

macOS: Wake up run loop immediately when request redraw is received #1812

Conversation

mr1sunshine
Copy link
Contributor

@mr1sunshine mr1sunshine commented Dec 31, 2020

We allow to have RunLoop running only on the main thread. Which means if
we call Window::request_redraw() from other the thread then we have to
wait until some other event arrives on the main thread. That situation
is even worse when we have ControlFlow set to the Wait mode then user
will not ever render anything.

The goal of this PR is a try to fix macOS-related part of the issue #1763 I was not sure if it is a good idea to wake up RunLoop directly from the AppState, so please correct me with the right place to add this logic if needed.

  • Tested on all platforms changed (only macOS is affected)
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • cargo doc builds successfully
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@mr1sunshine mr1sunshine force-pushed the mr1sunshine/fix-macos-request-redraw branch from c759d50 to 14768fe Compare December 31, 2020 00:28
@mr1sunshine mr1sunshine marked this pull request as ready for review December 31, 2020 00:31
Copy link
Contributor

@ArturKovacs ArturKovacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks a lot. I'll merge this as soon as you resolve the merge conflicts.

@mr1sunshine mr1sunshine force-pushed the mr1sunshine/fix-macos-request-redraw branch from 04f1ae5 to 940503f Compare April 5, 2021 18:13
@mr1sunshine
Copy link
Contributor Author

@ArturKovacs should be good now, please proceed with merge.

We allow to have RunLoop running only on the main thread. Which means if
we call Window::request_redraw() from other the thread then we have to
wait until some other event arrives on the main thread. That situation
is even worse when we have ControlFlow set to the `Wait` mode then user
will not ever render anything.
@mr1sunshine mr1sunshine force-pushed the mr1sunshine/fix-macos-request-redraw branch from 940503f to 1be11a2 Compare April 5, 2021 18:43
@ArturKovacs ArturKovacs merged commit 0487876 into rust-windowing:master Apr 6, 2021
@mr1sunshine mr1sunshine deleted the mr1sunshine/fix-macos-request-redraw branch April 6, 2021 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants