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

[Windows] add is highcontrast #153

Merged
merged 5 commits into from
Oct 4, 2021
Merged

Conversation

i10416
Copy link
Contributor

@i10416 i10416 commented Sep 19, 2021

separate changes in #143

I separated #143 because it becomes a bit messy.
This PR contains changes related to isHighcontrast functionality.

@tonsky
Copy link
Collaborator

tonsky commented Sep 19, 2021

Thanks! I'll take a look next week

Copy link
Collaborator

@tonsky tonsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea to split PR into small chunks! I like the implementation, the only issue I have with it is that it should be on a separate static class, now on a Window (apologies if I ever suggested otherwise)

/**
* <p>check whether OS currently uses high contrast mode.</p>
*/
public abstract boolean isHighContrast();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were correct in #143 that themes are per-app, not per-window. Apologies if it was me who confused and/or suggested this method to be on a Window class.

It could either go on App or on a new class called Theme, similar how Clipboard groups all the functions related to clipboard manipulation. I suggest Theme.

Note: this would be different from dark/light enum, this will be a class containing static methods like isHighContrast() etc. We’ll have to come up with something different re: dark/light

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to your advice, I added a Theme class.

shared/cc/ThemeHelper.hh Outdated Show resolved Hide resolved
windows/cc/ThemeHelperWin32.hh Outdated Show resolved Hide resolved
@tonsky tonsky force-pushed the main branch 5 times, most recently from 70c2fcc to 7c84338 Compare September 24, 2021 22:04
@i10416
Copy link
Contributor Author

i10416 commented Sep 25, 2021

I have one question. (I am not quite familiar with GUI app and this may be a stupid question).
_onUIThread is called everywhere, what is this for?

@tonsky
Copy link
Collaborator

tonsky commented Sep 27, 2021

I have one question. (I am not quite familiar with GUI app and this may be a stupid question).
_onUIThread is called everywhere, what is this for?

It’s important that all communication with OS APIs, either it’s on Windows, Linux or Mac, happen from the same thread on which window was created. We (and most of the other UI framewors) call it UI thread. It’s usually a single dedicated thread where even loop was started and it’s usually blocked in that loop.

_onUIThread is an assertion that you are, actually, on that thread when the method is called. If you are not, you get and exception and should fix it.

Simple rule of thumb would be to put it everywhere.

@i10416 i10416 force-pushed the add-is-highcontrast branch from a21de28 to 0f67087 Compare October 2, 2021 14:55
@i10416 i10416 force-pushed the add-is-highcontrast branch from 0f67087 to 56eb769 Compare October 2, 2021 14:56
@i10416 i10416 requested a review from tonsky October 2, 2021 14:56
@tonsky tonsky merged commit c2557ee into HumbleUI:main Oct 4, 2021
@tonsky
Copy link
Collaborator

tonsky commented Oct 4, 2021

Thanks, merged

tonsky added a commit that referenced this pull request Oct 4, 2021
@tonsky
Copy link
Collaborator

tonsky commented Oct 4, 2021

I’ve pushed macOS impl and removed C++ ThemeWin32 class, seems unnecessary. Please take a look 5a680f3

tonsky added a commit that referenced this pull request Oct 4, 2021
tonsky added a commit that referenced this pull request Oct 4, 2021
tonsky added a commit that referenced this pull request Oct 4, 2021
@tonsky
Copy link
Collaborator

tonsky commented Oct 4, 2021

Actually, commit is now bada613, I rebased to fix compilation

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

Successfully merging this pull request may close these issues.

2 participants