Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Update to CEF 3.3497.1829.g004ef91

Post Reply
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Update to CEF 3.3497.1829.g004ef91

Post by salvadordf »

Hi,

CEF4Delphi is now updated to use CEF 3.3497.1829.g004ef91. It uses the same Chromium version as the previous update.

This CEF3 version includes these fixes : I also added a new component to test a focus issue. It's called TCEFLinkedWindowParent.

TCEFLinkedWindowParent is almost the same as TCEFWindowParent but it has a "Chromium" property where you can set the TChromium component used in your app to create a web browser.
TCEFLinkedWindowParent uses the Chromium value to set the focus like the official CEF3 application does.

You can use TCEFLinkedWindowParent or TCEFWindowParent in your apps but if you're having some kind of focus issue then try TCEFLinkedWindowParent.

The CEF3 binaries are these :
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Update to CEF 3.3497.1829.g004ef91

Post by thefunkyjoint »

Hello,

I was getting the same issue with this version : when i run the SimpleBrowser_D7 project, the app crashes. The log file shows the same content :

[0916/155930.742:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.
[0916/155930.748:VERBOSE1:webrtc_internals.cc(121)] Could not get the download directory.

But now i could find out what is causing the problem : it was related to the Windows theme i was using (High Contrast). Once i returned to the Default theme, the crashes solved ! :D

This explains why i was getting the crashes on the Windows 2012 machine (which was on High contrast theme) , but not on my Windows 7 / 10 machines (which use the Default theme).

I recorded a video showing the issue :

https://youtu.be/dXUQs_lEPYM

Discovering the cause is very good news however i (and probably anyone) can't use the High contrast theme anymore... I love it because it used inverted colors (black background instead of white). This problem never happened until the previous release. Maybe with this info you can simulate the problem and hopefully find out a solution / workaround to get me my beloved theme back :)

Thank you !
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 3.3497.1829.g004ef91

Post by salvadordf »

Good catch!!! :o

Even the official CEF3 application crashes with high contrast themes on windows 7.
I'll do some more tests and report this issue in the CEF3 project.

Thank you very much!!!! :D
petko
Posts: 52
Joined: Sun Jul 02, 2017 9:58 am

Re: Update to CEF 3.3497.1829.g004ef91

Post by petko »

salvadordf wrote: Sun Sep 16, 2018 9:18 amI also added a new component to test a focus issue. It's called TCEFLinkedWindowParent.

TCEFLinkedWindowParent is almost the same as TCEFWindowParent but it has a "Chromium" property where you can set the TChromium component used in your app to create a web browser.
TCEFLinkedWindowParent uses the Chromium value to set the focus like the official CEF3 application does.

You can use TCEFLinkedWindowParent or TCEFWindowParent in your apps but if you're having some kind of focus issue then try TCEFLinkedWindowParent.
Is there an equivalent of TCEFLinkedWindowParent for TChromiumWindow? In other words can TChromiumWindow automatically set the focus like TCEFLinkedWindowParent?
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 3.3497.1829.g004ef91

Post by salvadordf »

The main difference between TCEFWindowParent and TCEFLinkedWindowParent is in the WndProc procedure.

TCEFWindowParent handles WM_SETFOCUS with this code :

Code: Select all

    WM_SETFOCUS:
      begin
        TempHandle := ChildWindowHandle;
        if (TempHandle <> 0) then PostMessage(TempHandle, WM_SETFOCUS, aMessage.WParam, 0);
        inherited WndProc(aMessage);
      end;
TCEFLinkedWindowParent handles WM_SETFOCUS with this code :

Code: Select all

    WM_SETFOCUS:
      begin
        if (FChromium <> nil) then
          FChromium.SetFocus(True)
         else
          begin
            TempHandle := ChildWindowHandle;
            if (TempHandle <> 0) then PostMessage(TempHandle, WM_SETFOCUS, aMessage.WParam, 0);
          end;

        inherited WndProc(aMessage);
      end;
TChromiumWindow has exactly the same code in WndProc than TCEFLinkedWindowParent.
They should behave identically when they receive a WM_SETFOCUS message.
petko
Posts: 52
Joined: Sun Jul 02, 2017 9:58 am

Re: Update to CEF 3.3497.1829.g004ef91

Post by petko »

For some reason it is not working as expected for me. I have to manually set ActiveControl to the Chromium Window component (or use PostMessage(chromiumWindow->Handle, WM_SETFOCUS, 0, 0);) when it fires the GotFocus event. If I do not do that, then the ActiveControl stays the previously focused and not the Chromium..
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 3.3497.1829.g004ef91

Post by salvadordf »

What is the "TabStop" value for the TChromiumWindow?
If it's false, set it to true.
petko
Posts: 52
Joined: Sun Jul 02, 2017 9:58 am

Re: Update to CEF 3.3497.1829.g004ef91

Post by petko »

Yes, it was set to false, but unfortunately, setting it to true didn't fix the problem.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 3.3497.1829.g004ef91

Post by salvadordf »

I'll add a new property to TChromiumWindow to use a simple message to set the focus.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 3.3497.1829.g004ef91

Post by salvadordf »

Please, download CEF4Delphi again.

Set the TChromiumWindows.UseSetFocus to FALSE to use a Windows message to set the focus.
Post Reply