Skip to content

added windows system fonts listener #563

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

Merged
merged 1 commit into from
Sep 19, 2019

Conversation

chunhtai
Copy link
Contributor

This will requires https://github.com/flutter/engine/pull/12276/files for the new embedding api

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@chunhtai
Copy link
Contributor Author

@stuartmorgan This is ready for review. For some reason, I can't add a reviewer

@stuartmorgan-g stuartmorgan-g self-requested a review September 17, 2019 04:34
@stuartmorgan-g
Copy link
Collaborator

Will try to review tomorrow; currently swamped.

@@ -40,7 +42,7 @@ class Win32Window {
// as logical pixels and scale to appropriate for the default monitor. Returns
// true if the window was created successfully.
bool CreateAndShow(const std::wstring &title, const Point &origin,
const Size &size);
const Size &size, flutter::FlutterViewController *controller);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like to see a limited-purpose interface (e.g., FlutterWindowDelegate or similar) passed rather than the whole controller, with only the specific methods the window needs access to.

@@ -114,6 +116,9 @@ Win32Window::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam,
SetFocus(child_content_);
}
return 0;
case WM_FONTCHANGE:
controller_->OnFontChange();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know enough about Windows to know if this is a reasonable suggestion or not, but I'm curious if we could forward WM_FONTCHANGE to child_content_ and avoid the need for the special-purpose APIs at the embedding layer. Then we could just handle WM_FONTCHANGE in the embedding layer (in fact, you already do, where I commented wondering whether that code was doing anything).

@clarkezone Is that doable? A good/bad idea?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems reasonable. I assume WM_FONTCHANGE isn’t automatically propogated to child windows hence the approach here, but manually posting it would avoid the need for the API as you say.

Copy link
Contributor Author

@chunhtai chunhtai Sep 19, 2019

Choose a reason for hiding this comment

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

Is there a standard way to forward windows message? It does not seem like windows provide an api to reroute message to child process. If we want to use sendMessage to forward the message, the embedding will have to start a message loop as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

reroute message to child process

It's not a child process, it's just a different HWND in the same process.

If we want to use sendMessage to forward the message, the embedding will have to start a message loop as well

Why would that be the case? The child window already receives messages (e.g., mouse events), so clearly the existing message loop is capable of sending messages to that HWND.

Also, the docs for SendMessage say: "If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine." I would expect this is the same thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i made it too complicated, fixed

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@@ -114,6 +114,11 @@ Win32Window::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam,
SetFocus(child_content_);
}
return 0;

// Messages directly forward to embedding.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: s/forward/forwarded/

@stuartmorgan-g
Copy link
Collaborator

You'll need to fix the commit email address and force-push to address the CLA issue, then it'll be good to land.

While you're doing that, could you replicate this change in testbed/? I'd like them to stay in sync as much as possible.

@chunhtai
Copy link
Contributor Author

You'll need to fix the commit email address and force-push to address the CLA issue, then it'll be good to land.

While you're doing that, could you replicate this change in testbed/? I'd like them to stay in sync as much as possible.

will do, for some reason my windows desktop does not play well with github, will fixes it once i finalize both engine embedding and here.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@stuartmorgan-g stuartmorgan-g merged commit e7676d3 into google:master Sep 19, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants