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

System Theme vs Window Theme #3837

Closed
daxpedda opened this issue Jul 29, 2024 · 3 comments · Fixed by #3838
Closed

System Theme vs Window Theme #3837

daxpedda opened this issue Jul 29, 2024 · 3 comments · Fixed by #3838
Labels
DS - macos DS - web DS - windows S - api Design and usability S - platform parity Unintended platform differences

Comments

@daxpedda
Copy link
Member

In #3736 the meaning of Window::theme() was changed to not return the system theme, ergo returning None without a theme override through Window::set_theme().
This is how currently MacOS works, but not how Web and Windows do.

I propose the following change:

  • The meaning of Window::theme() should be changed to return the current window theme, if no override is in place it returns the system theme. I think a use-case for only returning an override has yet to be observed.
  • MacOS should return the system theme in Window::theme() if no theme override is in place.
  • A new ActiveEventLoop::system_theme() method should be introduced that returns the system theme.
  • (optional) A new Window::system_theme() convenience method should be added that returns the same as ActiveEventLoop::system_theme().

Cc @madsmtm.

@tronical
Copy link
Contributor

I like that proposal. Would you accept a PR that could be included in 0.30.x that follows up on #3736 and makes theme() on macOS fall back to effectiveAppearance? Something like this (untested):

let window = self.window();
Some(appearance_to_theme(unsafe { &*window.appearance().unwrap_or_else(|| &*window.effectiveAppearance()) }))

@daxpedda
Copy link
Member Author

daxpedda commented Jul 29, 2024

A PR (#3838) is already in place.
We have to come to a consensus though what the actual definition of Window::theme() should become before we discuss any backporting.

@tronical
Copy link
Contributor

Ah great, thanks :)

kchibisov pushed a commit that referenced this issue Aug 5, 2024
This also fixes macOS returning `None` in `Window::theme()` if no theme
override is set, instead it now returns the system theme.

MacOS and Wayland were the only ones working correctly according to the
documentation, which was an oversight. The documentation was "fixed"
now.

Fixes #3837.
kchibisov pushed a commit that referenced this issue Aug 7, 2024
This also fixes macOS returning `None` in `Window::theme()` if no theme
override is set, instead it now returns the system theme.

MacOS and Wayland were the only ones working correctly according to the
documentation, which was an oversight. The documentation was "fixed"
now.

Fixes #3837.
kchibisov pushed a commit that referenced this issue Aug 8, 2024
This also fixes macOS returning `None` in `Window::theme()` if no theme
override is set, instead it now returns the system theme.

MacOS and Wayland were the only ones working correctly according to the
documentation, which was an oversight. The documentation was "fixed"
now.

Fixes #3837.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DS - macos DS - web DS - windows S - api Design and usability S - platform parity Unintended platform differences
Development

Successfully merging a pull request may close this issue.

2 participants