Skip to content

x11: compute resize logical size with new dpi - #668

Merged
francesca64 merged 2 commits into
rust-windowing:masterfrom
elinorbgr:master
Oct 19, 2018
Merged

francesca64 merged 2 commits into
rust-windowing:masterfrom
elinorbgr:master

Conversation

@elinorbgr

@elinorbgr elinorbgr commented Oct 3, 2018 •

Copy link
Copy Markdown
Contributor

This change does 2 things to the x11 backend:

  • change the order of processing of the contents of events so that checking the current monitor and retrieving the dpi is done before computing the logical size of the window
  • whenever the dpi changes, always queue a Resized event with the new, correct logical size
    • given on x11 the physical size is constant by default, a dpi change changes the logical size, so any previous logical size becomes wrong, hence the need for this event

This should hopefully fix #663, but I don't really have the environment to test it right now.

cc @chrisduerr

  • Tested on all platforms changed
  • 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 an example program if it would help users understand this functionality

@elinorbgr elinorbgr added DS - x11 Affects the X11 backend, or generally free Unix platforms C - waiting on maintainer A maintainer must review this code S - platform parity Unintended platform differences labels Oct 3, 2018
@chrisduerr

Copy link
Copy Markdown
Contributor

I've linked Alacritty's glutin update PR against this change and was able to successfully use it on both Sway and i3 without any issues.

@elinorbgr

Copy link
Copy Markdown
Contributor Author

Alright, I've also clarified a little the DPI docs to clarify how to interpret the interaction between the Resized and HiDPIFactorChanged events.

Whenever a dpi change occurs, trigger a Resized event as well with the
new logical size. Given X11 primarily deals in physical pixels, a change
in DPI also changes the logical size (as the physical size remains
fixed).
@elinorbgr

Copy link
Copy Markdown
Contributor Author

r? @mitchmindtree or @francesca64 ?

@francesca64

Copy link
Copy Markdown
Member

Sorry this took me so long to get to! The code looks good, and I tested it without any problems. Are the documentation edits I made alright with you?

@elinorbgr

elinorbgr commented Oct 19, 2018 via email

Copy link
Copy Markdown
Contributor Author

@francesca64
francesca64 merged commit c744b01 into rust-windowing:master Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C - waiting on maintainer A maintainer must review this code DS - x11 Affects the X11 backend, or generally free Unix platforms S - platform parity Unintended platform differences

Development

Successfully merging this pull request may close these issues.

Resize events with DPI update in winit 0.17

3 participants