Carbon: fixes an endless loop in mouseover which was affecting the project openpoker

git-svn-id: trunk@31352 -
This commit is contained in:
sekelsenmat 2011-06-24 07:04:54 +00:00
parent 0e1e1911b7
commit 6acf2ce81d
2 changed files with 11 additions and 1 deletions

View File

@ -264,6 +264,7 @@ var
P, ClientPt, ControlPt: TPoint;
DesignPt: HIPoint;
ViewPart: HIViewPartCode;
lTmpWidget: TCarbonWidget;
begin
Result := EventNotHandledErr;
Postpone := False;
@ -286,7 +287,13 @@ begin
Widget := GetCarbonWidget(Control);
while Assigned(Widget) and not Widget.IsEnabled do
Widget := TCarbonWidget(CarbonWidgetset.GetParent(HWND(Widget)));
begin
// Here we need to avoid an endless loop which might occur in case
// GetParent returns the same widget that we passed
lTmpWidget := TCarbonWidget(CarbonWidgetset.GetParent(HWND(Widget)));
if lTmpWidget = Widget then Break;
Widget := lTmpWidget;
end;
if Widget = nil then Exit;
FillChar(Msg, SizeOf(Msg), 0);

View File

@ -1770,6 +1770,9 @@ begin
if TCarbonWidget(Handle) is TCarbonControl then
begin
{$IFDEF VerboseWinAPI}
DebugLn('TCarbonWidgetSet.GetParent Widget: ' + DbgS(TCarbonControl(Handle).Widget));
{$ENDIF}
Result := HWnd(GetCarbonWidget(HIViewGetSuperview(TCarbonControl(Handle).Widget)));
if Result = 0 then // no parent control => then parent is a window?
Result := HWnd(GetCarbonWidget(HIViewGetWindow(TCarbonControl(Handle).Widget)));