-
Notifications
You must be signed in to change notification settings - Fork 609
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
Conversation
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. ℹ️ Googlers: Go here for more info. |
57927ab
to
2b87a4f
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
@stuartmorgan This is ready for review. For some reason, I can't add a reviewer |
Will try to review tomorrow; currently swamped. |
example/windows/win32_window.h
Outdated
@@ -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); |
There was a problem hiding this comment.
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.
example/windows/win32_window.cc
Outdated
@@ -114,6 +116,9 @@ Win32Window::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam, | |||
SetFocus(child_content_); | |||
} | |||
return 0; | |||
case WM_FONTCHANGE: | |||
controller_->OnFontChange(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
2b87a4f
to
34a3935
Compare
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. ℹ️ Googlers: Go here for more info. |
example/windows/win32_window.cc
Outdated
@@ -114,6 +114,11 @@ Win32Window::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam, | |||
SetFocus(child_content_); | |||
} | |||
return 0; | |||
|
|||
// Messages directly forward to embedding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/forward/forwarded/
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 |
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. |
5d2d08d
to
a499580
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
This will requires https://github.com/flutter/engine/pull/12276/files for the new embedding api