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

wayland: rework scale factor handling #1538

Merged
merged 7 commits into from
Apr 22, 2020

Conversation

Matthias-Fauconneau
Copy link
Contributor

@Matthias-Fauconneau Matthias-Fauconneau commented Apr 17, 2020

wayland: rework scale factor handling

Fixes some hidpi use cases on wayland :

  • initialize with primary scale factor (avoid flicker)
  • also call Resize on scale factor changes
    apps usually resize their swap chains there and don't handle the explict scalefactorchanged.
    As discussed with kchibisov, calling this on any scale change even if it happens to yield same physical size (e.g move window from 4K laptop to 4K TV), as a defense in depth to try to trigger any application UI/font scale redraw (even when they don't explicitly handle scalefactorchanged).
    This might make applications do an identical swap chain resize as well if they don't check, but that's okay.
  • minor fix: inner_size within Resize callback (not hdpi related)

Fixes Iced

@kchibisov
Copy link
Member

kchibisov commented Apr 17, 2020

It seems like this it is this bug #1451 , right? I completely forgot about this issue in winit, thx.

@Matthias-Fauconneau
Copy link
Contributor Author

Indeed. Could have saved some time if this had gotten fixed right away. Can't see any reason why you'd want the old size :/

@kchibisov
Copy link
Member

I don't see any, but it was opened as a followed up to some other bug, which was closed for some reason, and I forgot about this issue, since I never use inner_size.

Copy link
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

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

I've memorized why it wasn't fixed right away, it's because you're not actually updating size, but just some variable, and your inner size will still be incorrect, so you're not fixing anything here. To fix it properly you should update size of the inner window, where this for each closure was invoked.

@Matthias-Fauconneau
Copy link
Contributor Author

Matthias-Fauconneau commented Apr 17, 2020 via email

@kchibisov
Copy link
Member

I'm not sure what is working here, but on your PR I get missmatch when running glutin window example, so it's not a fix.

INNER SIZE PhysicalSize { width: 1278, height: 1280 }
PHysical size PhysicalSize { width: 1280, height: 1280 }

@Matthias-Fauconneau
Copy link
Contributor Author

Matthias-Fauconneau commented Apr 17, 2020 via email

@Matthias-Fauconneau Matthias-Fauconneau marked this pull request as draft April 17, 2020 13:13
@Matthias-Fauconneau Matthias-Fauconneau marked this pull request as ready for review April 18, 2020 00:01
@Matthias-Fauconneau Matthias-Fauconneau changed the title wayland: Update window size before calling Resized so that window.inn… wayland: rework scale factor handling Apr 18, 2020
Copy link
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

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

It's fine from me.

cc @vberger if it fixes your anvil issue.

@elinorbgr elinorbgr merged commit 114fe9d into rust-windowing:master Apr 22, 2020
@elinorbgr
Copy link
Contributor

Thanks!

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