Skip to content

Convert macosx backend to use device_pixel_ratio #21365

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

Merged
merged 1 commit into from
Oct 20, 2021

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Oct 15, 2021

PR Summary

This was not originally implemented in #19126, but causes some inconsistencies with other backends.

This also sets the initial scale as implemented in #18274.

I tested this out on MacStadium, but it only has a single display which isn't Retina. If you have a Retina display, you can check that the window is correctly double-sized.

If you have two displays, with mixed DPI, then you can check the full functionality. If you create a window on one display, and move it to the other, it should shrink/grow accordingly. A test I do is to start an interpreter, go to interactive mode, and open a figure on each display (on mutter, where your mouse is determines where a window first appears; I don't know if that's the same on macOS). Then you can drag one to the other display, and if resized correctly, they should match each other. Additionally, call fig.set_size_inches(3, 3) on both while on different displays, and bringing them together should be the same size.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [n/a] New features are documented, with examples if plot related.
  • [n/a] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [n/a] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [n/a] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@QuLogic QuLogic added this to the v3.5.0 milestone Oct 15, 2021
Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

This works as expected for me.

I also rebased this onto #21212 and both work as expected now, with this fixing the issue that cropped up over there on macosx as well.

@QuLogic
Copy link
Member Author

QuLogic commented Oct 15, 2021

A few other tests I should have mentioned (that should only need checking on a Retina display):

  • The mouse cursor display in the toolbar message should be reasonable
  • The zoom select box should match the cursor position
  • Saving a figure from the toolbar button should use the original DPI, and not be zoomed in double size (I think this was fixed for all backends in another PR, but don't know for sure with macosx).

@greglucas
Copy link
Contributor

I just tested all of those cases and they all produce the expected output for me. These two PRs work well with the mixed DPI cases for me locally.

This was not originally implemented in matplotlib#19126, but causes some
inconsistencies with other backends.

This also sets the initial scale as implemented in matplotlib#18274.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants