feat: add a function to set theme dynamically
Closes #582 Closes #891
~~I don't quite understand how ThemeChanged works in tao to be honest, when should it be fired? We currently only fires it when the window's theme is set to auto/no preference and the theme is actually changed
I think it should be fired whenever the theme changes no matter if the theme is set to None or Some(Theme)~~ Never mind, only auto will can have theme changes
I'm not sure how to send events from set_theme, do we do a RegisterWindowMessage and use PostMessage here?
We probably can just mirror the mac and linux implementations from winit (they should be much more straight forward compared to the Windows one 😂), but I can't test them, so I'll just do the Windows one for now
Moving my discord message here: The macos implementation worked on my machine. 👍
Package Changes Through 0b1daad1c1d6b88f983fde6d07ea9d21241c4ff2
There are 1 changes which include tao with patch
Planned Package Versions
The following package releases are the planned based on the context of changes in this pull request.
| package | current | next |
|---|---|---|
| tao | 0.30.0 | 0.30.1 |
Add another change file through the GitHub UI by following this link.
Read about change files or the docs at github.com/jbolda/covector
Linux impl works for me on WSL
Looks good on macOS.
Just a note that the ThemeChagned event does not emit, but I think it has broken for a while.
I don't know if sending WM_SETTINGCHANGE ourselves here is fine or not since the wparam and lparam are actually not 0 from the system one, and by the way, if you do this, you need to set redraw_title_bar to true
I don't know if sending
WM_SETTINGCHANGEourselves here is fine or not since the wparam and lparam are actually not 0 from the system one
Doesn't matter since we don't read either of them.
and by the way, if you do this, you need to set
redraw_title_bartotrue
From my testing, this doesn't seem to be needed.
@amrbashir the windows one is not working right now, you need to set redraw_title_bar to true, see my comment above
I guess Windows 10, really needs to redraw, just changed it to always redraw then
BTW, sorry for hijacking the PR, I was just testing a few things out and thought might as well push it instead of requesting another review.
All good, feel free to make changes 😃