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

ThemeChanged event is emitted only once on macOS #836

Open
1 of 2 tasks
rhysd opened this issue Nov 5, 2023 · 2 comments
Open
1 of 2 tasks

ThemeChanged event is emitted only once on macOS #836

rhysd opened this issue Nov 5, 2023 · 2 comments

Comments

@rhysd
Copy link
Contributor

rhysd commented Nov 5, 2023

Describe the bug

After launching a window, the first ThemeChanged event is emitted as expected. But the event will not be emitted after that.

Steps To Reproduce

  1. Run the following example
  2. A window starts
  3. Go to the menu bar → 'System Settings' → 'Appearance'
  4. Choose the different theme in 'Appearance Mode' pane. For example, when the current theme is 'Light', then choose 'Dark'
  5. Check ThemeChanged event was emited correctly in terminal output
  6. Choose the different theme in 'Appearance Mode' pane again. This restores the original appearance mode
  7. ThemeChanged event is not emitted in terminal output

Expected behavior

ThemeChanged event should be emitted in terminal output

Screenshots

N/A

Platform and Versions (please complete the following information):
OS: macOS 13
Rustc: rustc 1.73.0 (cc66ad468 2023-10-03)

Would you want to assign yourself to resolve this bug?

  • Yes
  • No

Additional context

I did some quick triage on this issue and confirmed the followings.

  • effectiveAppearanceDidChangedOnMainThread notification was sent correctly on each theme change repeatedly
  • bestMatchFromAppearancesWithNames method always returns the same appearance name after the first theme change. For example, when the first theme is 'Light', it returns "NSAppearanceNameAqua". After first theme change to 'Dark', it returns "NSAppearanceNameDarkAqua" correctly. However, after the second theme change to 'Light', it still returns the same value "NSAppearanceNameDarkAqua"
  • winit does not have this issue. It notifies ThemeChanged event repeatedly on each theme change. I tried to understand the difference between winit and tao regarding to this feature, but as far as I checked, the implementation was almost the same. They used the same macOS APIs. I could not locate the cause of this bug.
@rhysd rhysd added the type: bug label Nov 5, 2023
@wusyong
Copy link
Member

wusyong commented Nov 12, 2023

Sorry but I couldn't reproduce this issue. I've tried the example from tao's window example and wry's simple example.
Both will get the event if I tried to change the appearance between light and dark.
Though my macOS version is 14.

@rhysd
Copy link
Contributor Author

rhysd commented Nov 12, 2023

Thank you for your try. Hmm, the difference is that my macOS version is 13 and yours is 14. It may be an OS version-specific problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants