Skip to content

Make media queries more robust#2850

Merged
daxpedda merged 1 commit intorust-windowing:masterfrom
daxpedda:web-media-query
Jun 5, 2023
Merged

Make media queries more robust#2850
daxpedda merged 1 commit intorust-windowing:masterfrom
daxpedda:web-media-query

Conversation

@daxpedda
Copy link
Copy Markdown
Member

@daxpedda daxpedda commented Jun 4, 2023

This improves on the original implementation: #1690.

  • Remove the use of MediaQueryListEvent, which isn't supported by Safari until v14. The callback parameter differs depending on browser support. Without MediaQueryListEvent support MediaQueryList is passed (spec). So we instead just clone the MediaQueryList into the closure.
  • Use accurate scale factors in the media query instead of approximating with min/max, which should avoid any further issues as discussed in Fixes rust-windowing/winit#2597 for good #2747 (comment).
  • Always initialize media queries. They should always work unless something is seriously wrong with our code.

Reverts #2599.
Replaces #2747 as discussed in #2747 (comment).

@daxpedda daxpedda added the DS - web Affects the Web backend (WebAssembly/WASM) label Jun 4, 2023
@daxpedda daxpedda merged commit 12fb37d into rust-windowing:master Jun 5, 2023
@daxpedda daxpedda mentioned this pull request Jun 11, 2023
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - web Affects the Web backend (WebAssembly/WASM)

Development

Successfully merging this pull request may close these issues.

1 participant