mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-18 16:42:38 +02:00
LCL-CustomDrawn-X11: Buffer all invalidate calls and execute at most one per form per event
git-svn-id: trunk@36065 -
This commit is contained in:
parent
cd63f40bc8
commit
2e54dd5e2e
@ -46,10 +46,10 @@
|
||||
|
||||
// This option makes the drawing faster by buffering previous drawing operations
|
||||
{$define CD_BufferControlImages} // for all wincontrols except the form
|
||||
//{$define CD_BufferFormImage} // for the form itself (excluding child wincontrols)
|
||||
{ $define CD_BufferFormImage} // for the form itself (excluding child wincontrols)
|
||||
|
||||
// ==================
|
||||
// Debug options
|
||||
// ==================
|
||||
//{$define VerboseCDPaintProfiler}
|
||||
{$define VerboseCDPaintProfiler}
|
||||
|
||||
|
@ -164,6 +164,7 @@ type
|
||||
|
||||
function FindWindowByXID(XWindowID: X.TWindow; out AWindowInfo: TX11WindowInfo): TWinControl;
|
||||
procedure AppProcessMessage;
|
||||
procedure AppProcessInvalidates;
|
||||
{$endif}
|
||||
{$ifdef CD_Android}
|
||||
CombiningAccent: Cardinal;
|
||||
|
@ -126,7 +126,7 @@ begin
|
||||
BackendDestroy;
|
||||
|
||||
{$ifndef CD_UseNativeText}
|
||||
TT_Done_FreeType;
|
||||
//TT_Done_FreeType; Causes crashes =( Uncomment when bug 21470 is fixed
|
||||
FFontPaths.Free;
|
||||
FFontList.Free;
|
||||
{$endif}
|
||||
|
@ -288,7 +288,8 @@ procedure TCDWidgetSet.AppProcessMessages;
|
||||
begin
|
||||
while True do
|
||||
begin
|
||||
if XPending(FDisplay) <= 0 then Exit; // There are no more X messages to process
|
||||
// There are no more X messages to process
|
||||
if XPending(FDisplay) <= 0 then Exit;
|
||||
AppProcessMessage();
|
||||
end;
|
||||
end;
|
||||
@ -395,6 +396,27 @@ begin
|
||||
DebugLn('LCL-CustomDrawn-X11: Unhandled X11 event received: ', GetXEventName(XEvent._type));
|
||||
end;
|
||||
|
||||
AppProcessInvalidates();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCDWidgetSet.AppProcessInvalidates;
|
||||
var
|
||||
i: Integer;
|
||||
CurWindowInfo: TX11WindowInfo;
|
||||
lForm: TForm;
|
||||
begin
|
||||
for i := 0 to Screen.FormCount-1 do
|
||||
begin
|
||||
lForm := Screen.Forms[i];
|
||||
if (not lForm.HandleObjectShouldBeVisible) or
|
||||
(not lForm.HandleAllocated) then Continue;
|
||||
CurWindowInfo := TX11WindowInfo(Screen.Forms[i].Handle);
|
||||
if CurWindowInfo.InvalidateRequestedInAnyControl then
|
||||
begin
|
||||
TCDWSCustomForm.EvPaint(lForm, CurWindowInfo);
|
||||
CurWindowInfo.InvalidateRequestedInAnyControl := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -490,6 +512,7 @@ begin
|
||||
if lTimer.NativeHandle >= lTimer.Interval then
|
||||
begin
|
||||
lTimer.TimerFunc();
|
||||
AppProcessInvalidates();
|
||||
lTimer.NativeHandle := 0;
|
||||
end;
|
||||
end;
|
||||
|
@ -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
|
||||
InvalidateRequestedInAnyControl: Boolean;
|
||||
// painting objects which represent the composed form image, don't confuse with ControlImage/ControlCanvas
|
||||
Image: TLazIntfImage;
|
||||
Canvas: TLazCanvas;
|
||||
|
@ -631,7 +631,8 @@ begin
|
||||
end;*)
|
||||
|
||||
{$ifndef CD_UseNativeText}
|
||||
procedure TCDWidgetSet.BackendListFontPaths(var AFontPaths: TStringList; var AFontList: THashedStringList);
|
||||
procedure TCDWidgetSet.BackendListFontPaths(var AFontPaths: TStringList;
|
||||
var AFontList: THashedStringList);
|
||||
var
|
||||
Doc: TXMLDocument;
|
||||
lFontDirectories: TStringList;
|
||||
@ -4651,7 +4652,7 @@ var
|
||||
lFormHandle: TX11WindowInfo;
|
||||
begin
|
||||
lFormHandle := TX11WindowInfo(AHandle);
|
||||
TCDWSCustomForm.EvPaint(lFormHandle.LCLForm, lFormHandle);
|
||||
lFormHandle.InvalidateRequestedInAnyControl := True;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
@ -696,6 +696,7 @@ begin
|
||||
//SIZENORMAL, SIZEICONIC, SIZEFULLSCREEN, SIZEZOOMSHOW, SIZEZOOMHIDE.
|
||||
LCLSendSizeMsg(AWinControl, Event.Width, Event.Height, SIZENORMAL);
|
||||
|
||||
AWinControl.Invalidate;
|
||||
// TX11Canvas(Canvas).Resized(ClientWidth, ClientHeight); seams unnecessary here
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user