mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 02:29:26 +02:00
Gtk3: fixed TGtk3CustomControl.getClientRect, accidentally removed part of code in previous commit.issue #41498
This commit is contained in:
parent
9d39dd3e25
commit
283bf2e564
@ -9057,6 +9057,58 @@ begin
|
||||
if (Result.Width <= 1) and (Result.Height <= 1) then
|
||||
Result := Rect(0, 0, Widget^.get_allocated_width, Widget^.get_allocated_height);
|
||||
end;
|
||||
end else //we are wtContext - GtkFixed based.
|
||||
begin
|
||||
AViewport := getViewport;
|
||||
if Gtk3IsViewPort(AViewPort) and Gtk3IsGdkWindow(AViewPort^.get_view_window) then
|
||||
begin
|
||||
AViewPort^.get_view_window^.get_geometry(@x, @y, @w, @h);
|
||||
|
||||
Bar := getHorizontalScrollbar;
|
||||
if (Bar <> nil) and Gtk3IsWidget(Bar) and Bar^.get_visible and GTK3WidgetSet.OverlayScrolling then
|
||||
HOffset := Bar^.get_allocated_height
|
||||
else
|
||||
HOffset := 0;
|
||||
|
||||
Bar := getVerticalScrollbar;
|
||||
if (Bar <> nil) and Gtk3IsWidget(Bar) and Bar^.get_visible and GTK3WidgetSet.OverlayScrolling then
|
||||
VOffset := Bar^.get_allocated_width
|
||||
else
|
||||
VOffset := 0;
|
||||
|
||||
Result := Rect(0, 0, AViewPort^.get_view_window^.get_width - VOffset, AViewPort^.get_view_window^.get_height - HOffset);
|
||||
|
||||
{$IFDEF GTK3DEBUGSIZE}
|
||||
DebugLn('TGtk3CustomControl.GetClientRect via Viewport ',dbgsName(LCLObject),' Result ',dbgs(Result),' X=',dbgs(X),' Y=',dbgs(Y),' AllocH=',dbgs(AViewPort^.get_allocated_height),' OffsetH=',HOffset.ToString,' VOffset=',VOffset.ToString);
|
||||
getContainerWidget^.get_allocation(@Allocation);
|
||||
with ALlocation do
|
||||
begin
|
||||
DebugLn(Format(' GtkFixed alloc x %d y %d width %d height %d',[x, y, width, height]));
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
exit; // we are done here
|
||||
end else
|
||||
begin
|
||||
FCentralWidget^.get_allocation(@Allocation);
|
||||
if (Allocation.x = -1) and (Allocation.y = -1) and (Allocation.width <= 1) and (Allocation.Height <= 1) then
|
||||
FWidget^.get_allocation(@Allocation);
|
||||
end;
|
||||
|
||||
with Allocation do
|
||||
R := Rect(x, y, width + x, height + y);
|
||||
|
||||
if IsRectEmpty(R) then
|
||||
R := Rect(0, 0, 0, 0);
|
||||
|
||||
Result := R;
|
||||
{$IFDEF GTK3DEBUGSIZE}
|
||||
DebugLn('TGtk3CustomControl.GetClientRect via GtkFixed ',dbgsName(LCLObject),' Result=',dbgs(Result));
|
||||
{$ENDIF}
|
||||
|
||||
// DebugLn('TGtk3CustomControl.GetClientRect normal ',dbgsName(LCLObject),' Result ',dbgs(Result));
|
||||
Types.OffsetRect(Result, -Result.Left, -Result.Top);
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user