4430 Window Adjustments are not being respected.

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

4430 Window Adjustments are not being respected.

Postby leeroy » Thu Apr 22, 2021 10:17 pm

Recently after upgrading from CEF cef_binary_90.4.3+gc48a797+chromium-90.0.4430.51 to cef_binary_90.5.5+gf718c89+chromium-90.0.4430.72 window position and styling are not being respected after modifying the root window.

Microsoft Windows Server 2016 Datacenter
10.0.14393 Build 14393

Microsoft Windows 10 Pro for Workstations
10.0.19042 Build 19042

Code Snippets:
Code: Select all
window_config.always_on_top = true;
window_config.with_controls = false;
window_config.with_osr = false;
root_window_ = context->GetRootWindowManager()->CreateRootWindow(window_config);
root_window_HWND = root_window_->GetWindowHandle();
...
SetWindowLongPtr(root_window_HWND, GWL_STYLE, WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS| WS_VISIBLE);
MoveWindow(root_window_HWND, 0, 0, width, height, TRUE);
UpdateWindow(root_window_HWND);
//NO Change now...

or

ShowWindow(root_window_HWND, SW_SHOWMAXIMIZED);

//NO Change here either now...


I gather this has something to do with https://bitbucket.org/chromiumembedded/cef/issues/2969/support-chrome-windows-with-cef-callbacks, but I'm not sure I completely follow it.
leeroy
Techie
 
Posts: 48
Joined: Mon Jan 06, 2020 6:27 pm

Re: 4430 Window Adjustments are not being respected.

Postby magreenblatt » Thu Apr 22, 2021 10:44 pm

Is root_window_HWND a valid HWND?
magreenblatt
Site Admin
 
Posts: 10859
Joined: Fri May 29, 2009 6:57 pm

Re: 4430 Window Adjustments are not being respected.

Postby leeroy » Thu Apr 22, 2021 11:14 pm

It appears to be. I'm not sure what is the best mechanism to determine this.

Code: Select all
DWORD originalPID = 0;
GetWindowThreadProcessId(root_window_HWND , &originalPID);
//Do some stuff...
if (IsWindow(root_window_HWND ))
{
    DWORD newPID = 0;
    GetWindowThreadProcessId(root_window_HWND , &newPID);
    if (newPID == originalPID)
    {
       LOG(ERROR) << "!!!!!ORIGINAL";
    } else
    {
        LOG(ERROR) << "!!!!!CHANGED";
    }
 }


Prints: ` !!!!!ORIGINAL`
leeroy
Techie
 
Posts: 48
Joined: Mon Jan 06, 2020 6:27 pm

Re: 4430 Window Adjustments are not being respected.

Postby leeroy » Fri Apr 23, 2021 1:33 pm

I tried this with your prebuild CEF binaries using the cefclient and the same problem doesn't seem to present itself.

There is something else at play that changed between these versions. Maybe something is happening in a different order or not happening... Regardless I'll post my findings back here.
leeroy
Techie
 
Posts: 48
Joined: Mon Jan 06, 2020 6:27 pm

Re: 4430 Window Adjustments are not being respected.

Postby leeroy » Fri Apr 23, 2021 5:13 pm

I found the difference from cef_binary_90.4.3+gc48a797+chromium-90.0.4430.51 --> cef_binary_90.5.5+gf718c89+chromium-90.0.4430.72

The event onAfterCreated in the client handler now fires before the completion of the CreateRootWindow, ultimately the Show of RootWindowWin. We hang some logic of onAfterCreated and now that this is happening first, it breaks a number of things for us. Up until this point CreateRootWindow would complete before this fired.

I haven't looked specifically if this is true for the cefclient example, but true for what we have atm and trying to understand how this particular app potentially differs and it may not regarding this event timing.
leeroy
Techie
 
Posts: 48
Joined: Mon Jan 06, 2020 6:27 pm

Re: 4430 Window Adjustments are not being respected.

Postby leeroy » Wed Apr 28, 2021 4:40 pm

It looks like vanilla cefclient is consistent across 4430. I didn't go back and try every build.... The application I'm working on certainly was not. I don't see anything fundamentally different that would cause this disparity, however after cef_binary_90.5.5+gf718c89+chromium-90.0.4430.72 or thereabouts, it is essentially 100% consistent in behaviour with that of vanilla cefclient, as far as what fires when in CefClient lifecycle handler functions during the createrootwindow.

I'm going to bank on this and wrangle some of this logic around.
leeroy
Techie
 
Posts: 48
Joined: Mon Jan 06, 2020 6:27 pm

Re: 4430 Window Adjustments are not being respected.

Postby leeroy » Mon May 03, 2021 11:11 am

@magreenblatt I imagine https://bitbucket.org/chromiumembedded/ ... c671e8fdf2 is going to impact the behaviour documented here, as this issue happened on 90.5.1+g7823df5 forward. We are building this now, but it probably explains the impact to the timing of when createrootwindow is called and onAfterCreated in the client handler fires.
leeroy
Techie
 
Posts: 48
Joined: Mon Jan 06, 2020 6:27 pm

Re: 4430 Window Adjustments are not being respected.

Postby magreenblatt » Mon May 03, 2021 11:19 am

leeroy wrote:@magreenblatt I imagine https://bitbucket.org/chromiumembedded/ ... c671e8fdf2 is going to impact the behaviour documented here, as this issue happened on 90.5.1+g7823df5 forward. We are building this now, but it probably explains the impact to the timing of when createrootwindow is called and onAfterCreated in the client handler fires.

Agreed. This was the thread that I was thinking about when I added the "and possibly other platforms" in the above commit message :)
magreenblatt
Site Admin
 
Posts: 10859
Joined: Fri May 29, 2009 6:57 pm

Re: 4430 Window Adjustments are not being respected.

Postby leeroy » Mon May 03, 2021 4:51 pm

Confirmed, yes, that change solves this issue. It also appears to resolve another issue with some teardown we have. Though I haven't had a chance to debug what was actually happening there.
leeroy
Techie
 
Posts: 48
Joined: Mon Jan 06, 2020 6:27 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 21 guests