gtk2: r51664 #08fa33a88d refactoring

git-svn-id: trunk@51665 -
This commit is contained in:
ondrej 2016-02-19 09:57:21 +00:00
parent 08fa33a88d
commit bd1384ed17

View File

@ -6144,23 +6144,24 @@ var
P: TPoint;
begin
Result := 0; // error
if Handle <> 0 then
if Handle = 0 then
Exit;
Widget := {%H-}PGtkWidget(Handle);
if GTK_IS_WINDOW(Widget) and Assigned(Widget^.window)
and GTK_WIDGET_VISIBLE(Widget) // Gtk2 returns invalid origin/frame for invisible widgets
then
begin
gdk_window_get_origin(Widget^.window, @ARect.Left, @ARect.Top);
gdk_window_get_size(Widget^.window, @ARect.Right, @ARect.Bottom);
P := GetWidgetOrigin(Widget);
gdk_window_get_frame_extents(Widget^.window, @GRect);
ARect := Bounds(P.X,P.Y,GRect.width,GRect.height);
// writeln('Frame extents are: ',dbgs(R),' ARECT=',dbgs(AREct));
Result := 1; // success
end else
begin
Widget := {%H-}PGtkWidget(Handle);
if GTK_IS_WINDOW(Widget) and Assigned(Widget^.window)
and GTK_WIDGET_VISIBLE(Widget) then
begin
gdk_window_get_origin(Widget^.window, @ARect.Left, @ARect.Top);
gdk_window_get_size(Widget^.window, @ARect.Right, @ARect.Bottom);
P := GetWidgetOrigin(Widget);
gdk_window_get_frame_extents(Widget^.window, @GRect);
ARect := Bounds(P.X,P.Y,GRect.width,GRect.height);
// writeln('Frame extents are: ',dbgs(R),' ARECT=',dbgs(AREct));
Result := 1; // success
exit;
end;
ARect.TopLeft := GetWidgetOrigin(Widget);
if (ARect.Top <> -1) or (ARect.Left <> -1)
or (Widget^.allocation.width <> 1) or (Widget^.allocation.height <> 1) then