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

feat: add a function to set theme dynamically #937

Merged
merged 52 commits into from
Sep 19, 2024

Conversation

Legend-Master
Copy link
Contributor

@Legend-Master Legend-Master commented Jun 9, 2024

Closes #582
Closes #891

@Legend-Master
Copy link
Contributor Author

Legend-Master commented Jun 9, 2024

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 Legend-Master marked this pull request as ready for review June 9, 2024 10:04
@Legend-Master Legend-Master requested a review from a team as a code owner June 9, 2024 10:04
@Legend-Master
Copy link
Contributor Author

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 Legend-Master changed the title feat(windows): add a function to set theme dynamically feat: add a function to set theme dynamically Jun 14, 2024
@FabianLars
Copy link
Member

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

Copy link
Contributor

github-actions bot commented Jun 27, 2024

Package Changes Through 0b1daad

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

src/event_loop.rs Outdated Show resolved Hide resolved
src/event_loop.rs Outdated Show resolved Hide resolved
src/event_loop.rs Outdated Show resolved Hide resolved
src/platform_impl/windows/dark_mode.rs Outdated Show resolved Hide resolved
@Legend-Master
Copy link
Contributor Author

Legend-Master commented Sep 19, 2024

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

@amrbashir
Copy link
Member

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.

@Legend-Master
Copy link
Contributor Author

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

@amrbashir
Copy link
Member

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

@amrbashir
Copy link
Member

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.

@Legend-Master
Copy link
Contributor Author

All good, feel free to make changes 😃

@amrbashir amrbashir merged commit 1a085ad into tauri-apps:dev Sep 19, 2024
9 checks passed
@github-actions github-actions bot mentioned this pull request Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants