为cef在linux上面运行做准备
This commit is contained in:
tslediter 2023-12-26 16:42:10 +08:00
parent 85292744e9
commit d437977395
2 changed files with 59 additions and 14 deletions

View File

@ -23,8 +23,7 @@ type tcefowner = class(tcustomcontrol)
fcefwindows := array(); fcefwindows := array();
finitcef := true; finitcef := true;
sinit(); sinit();
fcefloop := new tcefmessage(); fcefloop := new tcefproc();
fcefloop.add();
app := initializeapplication(); app := initializeapplication();
app.addExitMessageLoopdo(thisfunction(cef_shutdown)); app.addExitMessageLoopdo(thisfunction(cef_shutdown));
cef_initialize(fargs._getptr_(), fappsetting._getptr_(), fcefapp._getptr_(),0); cef_initialize(fargs._getptr_(), fappsetting._getptr_(), fcefapp._getptr_(),0);
@ -60,8 +59,8 @@ type tcefowner = class(tcustomcontrol)
tp := unit(utslvclauxiliary).gettemppath(); tp := unit(utslvclauxiliary).gettemppath();
fappsetting.log_file := tp+"ceflogfile-"+datetostr(date())+".log"; 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 := %% F:\cef_105.3.39\AnalyseNG.NET\cefclient.exe%%;
fappsetting.browser_subprocess_path := tslpath()+"cefclient.exe"; fappsetting.browser_subprocess_path := tslpath()+"tsl_cef_main.exe";
fappsetting.cache_path := tp+"cefcatche";// %% F:\cef_105.3.39\tslcache%%; fappsetting.cache_path := tp+"-cefcatche-";// %% F:\cef_105.3.39\tslcache%%;
fappsetting.log_severity :=99;//0; fappsetting.log_severity :=99;//0;
end end
end end
@ -72,7 +71,6 @@ type tcefowner = class(tcustomcontrol)
width := 300; width := 300;
height := 300; height := 300;
fwinfo := new cef_window_info_t(); fwinfo := new cef_window_info_t();
fwinfo.style:= 1442906112;
fclient := new cef_client_t(); fclient := new cef_client_t();
{frm := new cef_life_span_handler_t(); {frm := new cef_life_span_handler_t();
frm.on_after_created := function(o,b)begin frm.on_after_created := function(o,b)begin
@ -346,7 +344,6 @@ type tcefowner = class(tcustomcontrol)
fwinfo; fwinfo;
fbrssetting; fbrssetting;
fhandlebk; fhandlebk;
class function tslpath(); //tsl.exe Ŀ¼ class function tslpath(); //tsl.exe Ŀ¼
begin begin
p := pluginpath(); p := pluginpath();

View File

@ -220,6 +220,30 @@ type cef_insets_t = class(tslcstructureobj)
property bottom index 2 read _getvalue_ write _setvalue_; property bottom index 2 read _getvalue_ write _setvalue_;
property right index 3 read _getvalue_ write _setvalue_; property right index 3 read _getvalue_ write _setvalue_;
end 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) type tcefmessage = class(TTSLProcessMsg)
function create(ptr); function create(ptr);
begin begin
@ -570,15 +594,34 @@ type cef_main_args_t=class(tslcstructureobj)
static SSTRUCT; static SSTRUCT;
class function getstruct() class function getstruct()
begin 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; return SSTRUCT;
end end
public 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) function create(ptr)
begin begin
inherited create(getstruct(),ptr); inherited create(getstruct(),ptr);
end end
property instance index "instance" read _getvalue_ write _setvalue_; property instance index "instance" read _getvalue_ write _setvalue_;
{$endif}
end end
type cef_basetime_t = class(cef_main_args_t) //32bit ¿ÉÄÜÓÐÎÊÌâÐèÒªÐÞÕý type cef_basetime_t = class(cef_main_args_t) //32bit ¿ÉÄÜÓÐÎÊÌâÐèÒªÐÞÕý
function create(ptr); function create(ptr);
@ -3642,9 +3685,7 @@ type cef_bounds_t = class(tslcstructureobj)
inherited create(getstruct(),ptr); inherited create(getstruct(),ptr);
end end
property x index "x" read _getvalue_ write _setvalue_; 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 y index "y" read _getvalue_ write _setvalue_;
//property bounds index "bounds" read _getvalue_ write _setvalue_;
property width index "width" read _getvalue_ write _setvalue_; property width index "width" read _getvalue_ write _setvalue_;
property height index "height" read _getvalue_ write _setvalue_; property height index "height" read _getvalue_ write _setvalue_;
end end
@ -3655,9 +3696,15 @@ type cef_window_info_t=class(cef_contain_base)
function structdescribe();override; function structdescribe();override;
begin begin
return array( return array(
{$ifdef linux}
{$else}
("ex_style","int",0), ("ex_style","int",0),
{$endif}
("window_name","user",getcefstr16struct()), ("window_name","user",getcefstr16struct()),
("style","int",0), {$ifdef linux}
{$else}
("style","int",1442906112),
{$endif}
("bounds","user",getcefboundsstruct()), ("bounds","user",getcefboundsstruct()),
("parent_window","intptr",0), ("parent_window","intptr",0),
("menu","intptr",0), ("menu","intptr",0),
@ -3665,6 +3712,7 @@ type cef_window_info_t=class(cef_contain_base)
("shared_texture_enabled","int",0), ("shared_texture_enabled","int",0),
("external_begin_frame_enabled","int",0), ("external_begin_frame_enabled","int",0),
("window","intptr",0)); ("window","intptr",0));
end end
function getbounds(); function getbounds();
begin begin