From d437977395dcfa301a70fdf1f078db7ffe640c80 Mon Sep 17 00:00:00 2001 From: tslediter Date: Tue, 26 Dec 2023 16:42:10 +0800 Subject: [PATCH] cef MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为cef在linux上面运行做准备 --- funcext/tvclib/utslvclcef.tsf | 11 ++--- funcext/tvclib/utslvclcefinterface.tsf | 62 +++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/funcext/tvclib/utslvclcef.tsf b/funcext/tvclib/utslvclcef.tsf index c733c27..72a1276 100644 --- a/funcext/tvclib/utslvclcef.tsf +++ b/funcext/tvclib/utslvclcef.tsf @@ -23,8 +23,7 @@ type tcefowner = class(tcustomcontrol) fcefwindows := array(); finitcef := true; sinit(); - fcefloop := new tcefmessage(); - fcefloop.add(); + fcefloop := new tcefproc(); app := initializeapplication(); app.addExitMessageLoopdo(thisfunction(cef_shutdown)); cef_initialize(fargs._getptr_(), fappsetting._getptr_(), fcefapp._getptr_(),0); @@ -60,8 +59,8 @@ type tcefowner = class(tcustomcontrol) tp := unit(utslvclauxiliary).gettemppath(); fappsetting.log_file := tp+"ceflogfile-"+datetostr(date())+".log"; //fappsetting.browser_subprocess_path := %% F:\cef_105.3.39\AnalyseNG.NET\cefclient.exe%%; - fappsetting.browser_subprocess_path := tslpath()+"cefclient.exe"; - fappsetting.cache_path := tp+"cefcatche";// %% F:\cef_105.3.39\tslcache%%; + fappsetting.browser_subprocess_path := tslpath()+"tsl_cef_main.exe"; + fappsetting.cache_path := tp+"-cefcatche-";// %% F:\cef_105.3.39\tslcache%%; fappsetting.log_severity :=99;//0; end end @@ -72,7 +71,6 @@ type tcefowner = class(tcustomcontrol) width := 300; height := 300; fwinfo := new cef_window_info_t(); - fwinfo.style:= 1442906112; fclient := new cef_client_t(); {frm := new cef_life_span_handler_t(); frm.on_after_created := function(o,b)begin @@ -345,8 +343,7 @@ type tcefowner = class(tcustomcontrol) furl; fwinfo; fbrssetting; - fhandlebk; - + fhandlebk; class function tslpath(); //tsl.exe Ŀ¼ begin p := pluginpath(); diff --git a/funcext/tvclib/utslvclcefinterface.tsf b/funcext/tvclib/utslvclcefinterface.tsf index 9a33f8f..e7e964e 100644 --- a/funcext/tvclib/utslvclcefinterface.tsf +++ b/funcext/tvclib/utslvclcefinterface.tsf @@ -220,6 +220,30 @@ type cef_insets_t = class(tslcstructureobj) property bottom index 2 read _getvalue_ write _setvalue_; property right index 3 read _getvalue_ write _setvalue_; end +type tcefproc = class() + function create(); + begin + cefproc_cunt++; + if cefproc_cunt=1 then + begin + cefprocer := new tcefmessage(); + cefprocer.add(); + end + end + function destroy(); + begin + cefproc_cunt--; + if cefproc_cunt=0 then + begin + cefprocer.remove(); + cefprocer := nil; + end + end + private + static cefproc_cunt; + static cefprocer; + +end type tcefmessage = class(TTSLProcessMsg) function create(ptr); begin @@ -570,15 +594,34 @@ type cef_main_args_t=class(tslcstructureobj) static SSTRUCT; class function getstruct() begin - if not SSTRUCT then SSTRUCT := MemoryAlignmentCalculate(array(("instance","intptr",0))); + if not SSTRUCT then + begin +{$ifdef linux} + SSTRUCT := MemoryAlignmentCalculate(array(("argc","int",0),("argv","intptr",0))); +{$else} + SSTRUCT := MemoryAlignmentCalculate(array(("instance","intptr",0))); +{$endif} + end return SSTRUCT; end public +{$ifdef linux} + function create(c,v); + begin + inherited create(getstruct(),0); + argc := c; + argv := v; + end + property argc index "argc" read _getvalue_ write _setvalue_; + property argv index "argv" read _getvalue_ write _setvalue_; +{$else} function create(ptr) begin inherited create(getstruct(),ptr); - end - property instance index "instance" read _getvalue_ write _setvalue_; + end + property instance index "instance" read _getvalue_ write _setvalue_; +{$endif} + end type cef_basetime_t = class(cef_main_args_t) //32bit Ҫ function create(ptr); @@ -3642,9 +3685,7 @@ type cef_bounds_t = class(tslcstructureobj) inherited create(getstruct(),ptr); end property x index "x" read _getvalue_ write _setvalue_; - //property window_name index "window_name" read _getvalue_ write _setvalue_; property y index "y" read _getvalue_ write _setvalue_; - //property bounds index "bounds" read _getvalue_ write _setvalue_; property width index "width" read _getvalue_ write _setvalue_; property height index "height" read _getvalue_ write _setvalue_; end @@ -3654,10 +3695,16 @@ type cef_window_info_t=class(cef_contain_base) fboundsaddr; function structdescribe();override; begin - return array( + return array( +{$ifdef linux} +{$else} ("ex_style","int",0), +{$endif} ("window_name","user",getcefstr16struct()), - ("style","int",0), +{$ifdef linux} +{$else} + ("style","int",1442906112), +{$endif} ("bounds","user",getcefboundsstruct()), ("parent_window","intptr",0), ("menu","intptr",0), @@ -3665,6 +3712,7 @@ type cef_window_info_t=class(cef_contain_base) ("shared_texture_enabled","int",0), ("external_begin_frame_enabled","int",0), ("window","intptr",0)); + end function getbounds(); begin