idle
This commit is contained in:
JianjunLiu 2022-11-24 14:14:16 +08:00
parent af29344e72
commit efe547e628
4 changed files with 103 additions and 94 deletions

View File

@ -215,10 +215,10 @@ type tapplication=class(tcomponent)
**}
initialize();
{$ifdef linuxgtk}
idledata :=(new tcbytearray(4))._getptr_();
id := tsl_gtk_idle_interface(idledata);//_wapi.tsl_gtk_idle_interface(idledata); //¹¹Ôìidle
//idledata :=(new tcbytearray(4))._getptr_();
//id := tsl_gtk_idle_interface(idledata);//_wapi.tsl_gtk_idle_interface(idledata); //¹¹Ôìidle
_wapi.gtk_main();
_Wapi.g_idle_remove_by_data(idledata); //ɾ³ýidle
//_Wapi.g_idle_remove_by_data(idledata); //ɾ³ýidle
return 1;
{$endif}
if not FMessageObj then FMessageObj := new TTagMSG();

View File

@ -6630,8 +6630,6 @@ type tGtkMessageQueue = class //
@ignore(忽略)
gtk消息队列
**}
private
public
function Create();
begin
@ -6643,26 +6641,28 @@ type tGtkMessageQueue = class //
function Add(h,m,l,w,obj);
begin
lock();
FLen++;
FData[FLen]:= array(h,m,l,w,obj);
if FCurrent=FLen then
begin
createidle();
end
FLen++;
unlock();
end
function Feach();
begin
lock();
if FCurrent<FLen then
begin
FCurrent++;
r := FData[FCurrent];
if (FCurrent+1<FLen) and FCurrent>100 then
FCurrent++;
if(FCurrent<FLen)and FCurrent>100 then
begin
FData := FData[FCurrent+1:];//min(FLen-1,FCurrent+100)];
FCurrent := -1;
FData := FData[FCurrent:]; //min(FLen-1,FCurrent+100)];
FCurrent :=0;
FLen := length(FData);
end
end
else
end else
begin
Clean();
end
@ -6675,11 +6675,11 @@ type tGtkMessageQueue = class //
lock();
while idx<FLen do
begin
idx++;
if FData[idx][0]=h and FData[idx][0]=m then
begin
FData[idx][0]:= 0;
end
idx++;
end
unlock();
end
@ -6688,21 +6688,19 @@ type tGtkMessageQueue = class //
idx := FCurrent;
if idx<FLen then
begin
idx++;
if((h=-1)or(FData[idx][0]=h))and FData[idx][0]=m then
begin
return 1;
end
idx++;
end
end
private
function Clean();
begin
FData := array();
FLen := 0;
FCurrent := -1;
FCurrent :=0;
end
FData;
FCurrent;
@ -6731,6 +6729,7 @@ type tGtkMessageQueue = class //
end
end
end
function _gtkeventcall_();//消息回调
begin
r := class(tgtk_ctl_object).DispatchGtkEventCall(params);
@ -6839,6 +6838,11 @@ begin
_wapi.cairo_destroy(cr);
_wapi.gtk_object_set_data(cr);
end
function createidle();
begin
idledata :=(new tcbytearray(4))._getptr_();
id := tsl_gtk_idle_interface(idledata);
end
function _gtkidledo_(); //回调
begin
d := FeachMessageFromGtkMessageQueue();
@ -6873,19 +6877,22 @@ begin
return 1;
end
return r;
return 1; //r
end
else
begin
tslprocessmessages(false);
//sleep(10);
end
r := 1;
end else
begin
r := 0;
tslprocessmessages(false);
//sleep(10);//休息一下
end
unit(uvclthreadworker).RunThreadWorkerHost();
return r;
end
procedure tslprocessmessages()begin end;
function InitGtkWindowClass(); //初始化窗口类

View File

@ -5566,6 +5566,7 @@ type TcustomStatusBar=class(TCustomControl)
if nv<>FItemOder then
begin
FItemOder := nv;
if FItems then
InvalidateRect(nil,false);
end
end
@ -6769,6 +6770,7 @@ end
initialization
{$ifdef linux}
class(tUIglobalData).uisetdata("G_T_TTIMER_",class(TCustomTimer));
class(TCustomTimer)._wapi.SetTimer(nil,10000,100,getwinprocptr(2));
{$endif}
end.