-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Focus improvements, take 5 #791
Conversation
…g goo so other people can more easily verify the changes. The additions to MovingListener (and the fields it sets on ChromiumWebBrowser) are ONLY there for debugging related purposes. They will disappear when folks are happy with the results.
@sylvain-hamel , @amaitland : Please try this PR out and let me know if you see anything that behaves incorrectly, and then send me the Debug output for the incorrect behavior. TL;DR: The long version:
WinForms actually (due to our handy call to I'll added some debugging logic to the pending MovingListener to track form activation/deactivation for possible logic inside Here are the sequences I tested: Reminder: Not all of these operations execute on the same thread, so the ordering may seem slightly odd. For tabbing to
For alt-tabbing away: (the CEF window still has focus)
For alt-tabbing back hoping the CEF control still has focus:
For minimizing (while CEF still has focus):
For restoring:
That sure was a LOT of work... ugh, |
@rassilon Amazing effort! Not long until I finish up for the day, I'll try and take a look over the weekend 👍 |
@rassilon I see |
Yes, this last commit where I add that bit on this branch. All of the testing occurred before I created this PR branch. Bill |
Oh, additionally: When you tab out of the browser control (and into the Dummy Text box):
Bill |
The AppVeyor failure was due to:
Fyi, |
Oh, if you launch these changes with I'm not entirely precisely sure why that happens at present. It's probably due to WinForm specifics in However, I think that makes sense in any event. Bill |
Poked the After pushing the |
Unfortunately I think we still have a problem. Steps to reproduce
|
As a reminder, However, even taking that into consideration, I am seeing CEF telling I haven't quite figured out why things are working this way just yet, so I'm not sure what the proper fix might be (if any). When the IDE does get in the way, the IDE is doing something really slowly (usually symbol loading). Fyi, |
Do you have some additional background information on that? I'm no Appreciate all the time you've spent on this 👍 |
Here's the bit I saw explaining Bill |
Thanks 👍 |
Merge remote-tracking branch 'origin/master' into focus_take5 Conflicts: CefSharp.WinForms/ChromiumWebBrowser.cs
Anybody want to try this out outside of the debugger and see if they can break it? I'm hoping the issue I saw just won't repro outside of the debugger. Bill |
I had a quick try and still seeing the same text box activation problem (not turning the background yellow). I'll provide a more detailed response when I get a chance. |
Hrm. Are we trying to ensure the ChromiumWebBrowser only gets focus when it should and that focus is sent to the correct control during activation if the last control that had focus wasn't the ChromiumWebBrowser control? Or are we trying to perfect turning the address bar yellow as well in order to verify controls that have custom focus behavior can have sane focus interactions with ChromiumWebBrowser if they do the correct things? I hadn't (up to now) been caring too much if the address bar didn't turn yellow when clicking into the address bar (during activation) since the correct event wasn't being listened to. Thoughts? Bill |
@sylvain-hamel Any comment? |
@rassilon, @amaitland we are trying to get the textbox to turn yellow because Cef/CefSharp prevents it from doing so. That's because of the way it handles activation/deactivation. You can refer to my original PR to see this test case working. |
@sylvain-hamel , do you want the address bar to turn white during deactivation? (i.e. alt-tab, or click on other app, etc...) I think I found the other problem that was still hiding. Bill |
…ebBrowser was the .ActiveControl before the app was deactivated. This will allow WinForm's .ActiveControl logic to occur properly. Update address bar logic to deal with BackColor being in yellow whenever the control has focus.
See the long essay I wrote in Please give this a spin everyone. ( @amaitland , @sylvain-hamel ) Thanks, |
@rassilon Great! Will check it out when I'm back in front of a PC with |
Cool. If it makes folks happy I'll do a cleanup pass. Bill |
Here's the TL;DR of the problem: Top level windows that exist in different threads than the main WinForm UI thread need to ensure they play nicely with WinForms Since the Bill |
@rassilon Looking very very promising 😄 Fantastic work 👍 @sylvain-hamel Mind taking the latest changes for a spin? |
@rassilon I'm happy for you to merge this one when your happy that it's ready! After you merge just need to add an entry to the |
I'll see about cleaning up the logging on Saturday and then merge it in. I'm busy having fun with Windows image creation and dism.exe this week at work. Thanks for trying this PR out. Bill |
No problem 👍 |
Hi @rassilon, @amaitland I'm sorry but it might take a while before I can give this a try. |
/// Set to true while handing an activating WM_ACTIVATE message. | ||
/// MUST ONLY be cleared by DefaultFocusHandler. | ||
/// </summary> | ||
internal bool IsActivating = false; |
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.
Should we expose this for users to set should they choose to implement IFocusHandler
totally from scratch? Potential side effects?
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 suppose you're right and it should be available to be set by their own IFocusHandler
. I'll fix it up.
Focus improvements, take 5...
Just an Think we can push ahead with |
...oo so other people can more easily verify the changes.
The additions to MovingListener (and the fields it sets on ChromiumWebBrowser) are ONLY there for debugging related purposes. They will disappear when folks are happy with the results.