mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 02:37:37 +01:00
* carbon: removed doubled-draw effect of invalidates inside painting event.
git-svn-id: trunk@19629 -
This commit is contained in:
parent
7277e0b12c
commit
8307ced794
@ -31,6 +31,21 @@ begin
|
|||||||
LCLSendDestroyMsg(AWidget.LCLObject); // widget is disposed in DestroyHandle
|
LCLSendDestroyMsg(AWidget.LCLObject); // widget is disposed in DestroyHandle
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Name: CarbonCommon_Draw
|
||||||
|
Handles draw event
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function CarbonWindow_ContentDraw(ANextHandler: EventHandlerCallRef;
|
||||||
|
AEvent: EventRef;
|
||||||
|
AWidget: TCarbonWidget): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||||
|
begin
|
||||||
|
if not isRepaint then
|
||||||
|
Result := CallNextEventHandler(ANextHandler, AEvent)
|
||||||
|
else
|
||||||
|
Result := noErr;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Name: CarbonCommon_Draw
|
Name: CarbonCommon_Draw
|
||||||
Handles draw event
|
Handles draw event
|
||||||
@ -43,6 +58,11 @@ var
|
|||||||
Win : WindowRef;
|
Win : WindowRef;
|
||||||
Content : HIViewRef;
|
Content : HIViewRef;
|
||||||
begin
|
begin
|
||||||
|
if isRepaint then
|
||||||
|
begin
|
||||||
|
Result := noErr;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF VerbosePaint}
|
{$IFDEF VerbosePaint}
|
||||||
Debugln('CarbonCommon_Draw ', DbgSName(AWidget.LCLObject));
|
Debugln('CarbonCommon_Draw ', DbgSName(AWidget.LCLObject));
|
||||||
@ -61,15 +81,11 @@ begin
|
|||||||
AWidget.Context.Reset;
|
AWidget.Context.Reset;
|
||||||
|
|
||||||
// let carbon draw/update
|
// let carbon draw/update
|
||||||
if not isRepaint or ( AWidget.InheritsFrom(TCarbonCustomControl) and not (AWidget is TCarbonScrollingWinControl)) then
|
Result := CallNextEventHandler(ANextHandler, AEvent);
|
||||||
Result := CallNextEventHandler(ANextHandler, AEvent)
|
|
||||||
else
|
|
||||||
Result := noErr;
|
|
||||||
|
|
||||||
if (AWidget is TCarbonControl) and
|
if (AWidget is TCarbonControl) and
|
||||||
(cceDraw in (AWidget as TCarbonControl).GetValidEvents) then
|
(cceDraw in (AWidget as TCarbonControl).GetValidEvents) then
|
||||||
begin
|
begin
|
||||||
// todo: find a way to erase old content
|
|
||||||
(AWidget as TCarbonControl).Draw;
|
(AWidget as TCarbonControl).Draw;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -84,7 +100,6 @@ begin
|
|||||||
finally
|
finally
|
||||||
Dispose(AStruct);
|
Dispose(AStruct);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AWidget.HasCaret then DrawCaret;
|
if AWidget.HasCaret then DrawCaret;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
@ -97,8 +112,8 @@ begin
|
|||||||
IsRepaint := true;
|
IsRepaint := true;
|
||||||
Win:=HIViewGetWindow(AWidget.Widget);
|
Win:=HIViewGetWindow(AWidget.Widget);
|
||||||
HIViewFindByID( HIViewGetRoot(Win), kHIViewWindowContentID, Content);
|
HIViewFindByID( HIViewGetRoot(Win), kHIViewWindowContentID, Content);
|
||||||
HIViewSetNeedsDisplay(Content, true);
|
//HIViewSetNeedsDisplay(Content, true);
|
||||||
HIViewRender(Content);
|
HIViewRender(HIViewGetRoot(Win));
|
||||||
IsRepaint:=false;
|
IsRepaint:=false;
|
||||||
end;
|
end;
|
||||||
InvalidPaint:=false;
|
InvalidPaint:=false;
|
||||||
|
|||||||
@ -996,6 +996,7 @@ var
|
|||||||
KeySpecs: array[0..3] of EventTypeSpec;
|
KeySpecs: array[0..3] of EventTypeSpec;
|
||||||
ActivateSpecs: array[0..1] of EventTypeSpec;
|
ActivateSpecs: array[0..1] of EventTypeSpec;
|
||||||
ShowWindowSpecs: array[0..2] of EventTypeSpec;
|
ShowWindowSpecs: array[0..2] of EventTypeSpec;
|
||||||
|
WinContent: HIViewRef;
|
||||||
begin
|
begin
|
||||||
// Window Events
|
// Window Events
|
||||||
|
|
||||||
@ -1078,6 +1079,14 @@ begin
|
|||||||
RegisterEventHandler(@CarbonCommon_User),
|
RegisterEventHandler(@CarbonCommon_User),
|
||||||
1, @TmpSpec, Pointer(Self), nil);
|
1, @TmpSpec, Pointer(Self), nil);
|
||||||
|
|
||||||
|
// paint content message
|
||||||
|
if (HIViewFindByID( HIViewGetRoot(fWindowRef), kHIViewWindowContentID, WinContent) = noErr) then
|
||||||
|
begin
|
||||||
|
TmpSpec := MakeEventSpec(kEventClassControl, kEventControlDraw);
|
||||||
|
InstallControlEventHandler(WinContent,
|
||||||
|
RegisterEventHandler(@CarbonWindow_ContentDraw),
|
||||||
|
1, @TmpSpec, Pointer(Self), nil);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCarbonWindow.CreateWindow(const AParams: TCreateParams);
|
procedure TCarbonWindow.CreateWindow(const AParams: TCreateParams);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user