Page 1 of 2
Linux Console Application
Posted: Tue Mar 12, 2024 1:23 pm
by alfredapple
Is it possible to use CEF4Delphi in a Linux Console Application? Without using any forms?
Re: Linux Console Application
Posted: Tue Mar 12, 2024 1:33 pm
by salvadordf
Hi,
I've never tried that but I guess it should be possible.
You can port the Lazarus_Windows/ConsoleBrowser2 demo to Linux.
You will probably have to replace some of its code with the code from the Lazarus_Linux_GTK3/OSRExternalPumpBrowser demo.
Re: Linux Console Application
Posted: Wed Mar 13, 2024 10:42 pm
by alfredapple
Thank you. I can't believe how couldn't I see ConsoleBrowser2 demo.
I am trying to port it now. If I am successful, I will share here.
Re: Linux Console Application
Posted: Thu Mar 14, 2024 7:14 am
by salvadordf
I'm also creating a new console demo that should work on Linux.
Your message made me realize that it was missing.
Re: Linux Console Application
Posted: Thu Mar 14, 2024 7:08 pm
by salvadordf
I just uploaded the Lazarus_Linux_Console/ConsoleBrowser demo to GitHub.
It just takes a snapshot of the default URL and saves it as snapshot.png.
It uses a browser in OSR mode with a second executable for the CEF subprocesses.
Re: Linux Console Application
Posted: Thu Mar 14, 2024 9:44 pm
by alfredapple
Thank you. You are great.
Re: Linux Console Application
Posted: Wed Mar 27, 2024 10:39 am
by dominicelliott
alfredapple wrote: ↑Tue Mar 12, 2024 1:23 pm
Is it possible to use CEF4Delphi in a Linux Console Application? Without using any forms?
I also tried and it didn't work
Re: Linux Console Application
Posted: Mon Apr 15, 2024 7:38 pm
by alfredapple
salvadordf wrote: ↑Thu Mar 14, 2024 7:08 pm
I just uploaded the
Lazarus_Linux_Console/ConsoleBrowser demo to GitHub.
It just takes a snapshot of the default URL and saves it as
snapshot.png.
It uses a browser in OSR mode with a second executable for the CEF subprocesses.
I am trying to use CefRegisterExtension function on the demo, but OnWebKitInitialized is not running. Can you help about this?
Re: Linux Console Application
Posted: Mon Apr 15, 2024 8:44 pm
by salvadordf
That event is called on the render subprocess and Lazarus debugs the main browser process.
Read this document if you need to debug the code in that event :
https://www.briskbard.com/index.php?lang=en&pageid=cef#debugging
Edit :
The demos that use a different executable for the CEF subprocesses have to implement the events that run in CEF subprocesses in the subprocess project. For example, the Lazarus_Windows/JavaScript/JSWindowBindingSubProcess demo implements OnContextCreated in SubProcess.lpr
Re: Linux Console Application
Posted: Mon Apr 15, 2024 8:53 pm
by alfredapple
Hmm..
It seems like it's executing while I set GlobalCEFApp.SingleProcess := True;
but it's not executing when it's false.
Why is that?