LCL-CustomDrawn-X11: Further optimized the invalidation by redrawing only after all events are finished

git-svn-id: trunk@36067 -
This commit is contained in:
sekelsenmat 2012-03-16 07:28:54 +00:00
parent 6cc1867b3f
commit 32b1b8d917
2 changed files with 10 additions and 4 deletions

View File

@ -166,6 +166,7 @@ var
begin
while (DoBreakRun = False) do
begin
if XPending(FDisplay) <= 0 then AppProcessInvalidates();
AppWaitMessage();
AppProcessMessage();
@ -289,7 +290,11 @@ begin
while True do
begin
// There are no more X messages to process
if XPending(FDisplay) <= 0 then Exit;
if XPending(FDisplay) <= 0 then
begin
AppProcessInvalidates();
Exit;
end;
AppProcessMessage();
end;
end;
@ -395,8 +400,6 @@ begin
else
DebugLn('LCL-CustomDrawn-X11: Unhandled X11 event received: ', GetXEventName(XEvent._type));
end;
AppProcessInvalidates();
end;
end;
@ -466,6 +469,7 @@ var
rfds: baseunix.TFDSet;
xconnnum, selectresult: integer;
IsFirstTimeout: Boolean;
AnyTimerProcessed: Boolean = False;
lTimer: TCDTimer;
lTimeoutInterval: Integer; // miliseconds
i: Integer;
@ -512,10 +516,11 @@ begin
if lTimer.NativeHandle >= lTimer.Interval then
begin
lTimer.TimerFunc();
AppProcessInvalidates();
AnyTimerProcessed := True;
lTimer.NativeHandle := 0;
end;
end;
if AnyTimerProcessed then AppProcessInvalidates();
if selectresult <> 0 then // We got a X event or the timeout happened
Exit

View File

@ -80,6 +80,7 @@ type
FocusedControl: TWinControl; // The control focused in the form
FocusedIntfControl: TWinControl; // The intf control focused in the form
LayoutAutoAdjusted: Boolean; // Indicates if the form layout was already auto-adjusted once
// For merging invalidate requests, currently utilized in X11
InvalidateRequestedInAnyControl: Boolean;
// painting objects which represent the composed form image, don't confuse with ControlImage/ControlCanvas
Image: TLazIntfImage;