tao icon indicating copy to clipboard operation
tao copied to clipboard

feat: add a function to set theme dynamically

Open Legend-Master opened this issue 1 year ago • 4 comments

Closes #582 Closes #891

Legend-Master avatar Jun 09 '24 07:06 Legend-Master

~~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?

Legend-Master avatar Jun 09 '24 08:06 Legend-Master

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

Legend-Master avatar Jun 10 '24 15:06 Legend-Master

Moving my discord message here: The macos implementation worked on my machine. 👍

FabianLars avatar Jun 14 '24 14:06 FabianLars

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

github-actions[bot] avatar Jun 27 '24 02:06 github-actions[bot]

Linux impl works for me on WSL

FabianLars avatar Jul 25 '24 10:07 FabianLars

Looks good on macOS.

Just a note that the ThemeChagned event does not emit, but I think it has broken for a while.

pewsheen avatar Jul 29 '24 10:07 pewsheen

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

Legend-Master avatar Sep 19 '24 14:09 Legend-Master

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

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_bar to true

From my testing, this doesn't seem to be needed.

amrbashir avatar Sep 19 '24 14:09 amrbashir

@amrbashir the windows one is not working right now, you need to set redraw_title_bar to true, see my comment above

Legend-Master avatar Sep 19 '24 14:09 Legend-Master

I guess Windows 10, really needs to redraw, just changed it to always redraw then

amrbashir avatar Sep 19 '24 14:09 amrbashir

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.

amrbashir avatar Sep 19 '24 14:09 amrbashir

All good, feel free to make changes 😃

Legend-Master avatar Sep 19 '24 14:09 Legend-Master