mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 11:30:28 +02:00
Gtk3: fixed GetWindowRect() so it return proper values on x11 and wayland.
This commit is contained in:
parent
654245a39e
commit
8077d8dae0
@ -2952,6 +2952,7 @@ var
|
|||||||
AWindow: PGtkWindow;
|
AWindow: PGtkWindow;
|
||||||
x, y, aWidth, aHeight: gint;
|
x, y, aWidth, aHeight: gint;
|
||||||
Allocation: TGtkAllocation;
|
Allocation: TGtkAllocation;
|
||||||
|
AGdkWindow: PGdkWindow;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if IsValidHandle(Handle) then
|
if IsValidHandle(Handle) then
|
||||||
@ -2961,18 +2962,34 @@ begin
|
|||||||
AWindow := PGtkWindow(TGtk3Widget(Handle).Widget);
|
AWindow := PGtkWindow(TGtk3Widget(Handle).Widget);
|
||||||
if not TGtk3Window(Handle).WidgetMapped then
|
if not TGtk3Window(Handle).WidgetMapped then
|
||||||
AWindow := nil;
|
AWindow := nil;
|
||||||
|
|
||||||
|
if AWindow <> nil then
|
||||||
|
AGdkWindow := AWindow^.get_window
|
||||||
|
else
|
||||||
|
AGdkWindow := nil;
|
||||||
|
|
||||||
end else
|
end else
|
||||||
AWindow := nil;
|
AWindow := nil;
|
||||||
if AWindow <> nil then
|
if AWindow <> nil then
|
||||||
|
begin
|
||||||
|
if Assigned(AGdkWindow) then
|
||||||
|
begin
|
||||||
|
AGdkWindow^.get_origin(@x, @y);
|
||||||
|
AGdkWindow^.get_frame_extents(@Allocation);
|
||||||
|
AWidth := Allocation.Width;
|
||||||
|
AHeight := Allocation.Height;
|
||||||
|
end else
|
||||||
begin
|
begin
|
||||||
AWindow^.get_position(@x, @y);
|
AWindow^.get_position(@x, @y);
|
||||||
AWindow^.get_size(@aWidth, @aHeight);
|
AWindow^.get_size(@aWidth, @aHeight);
|
||||||
|
end;
|
||||||
ARect := Bounds(x, Y, AWidth, AHeight);
|
ARect := Bounds(x, Y, AWidth, AHeight);
|
||||||
Result := 1;
|
Result := 1;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
TGtk3Widget(Handle).Widget^.get_allocation(@Allocation);
|
TGtk3Widget(Handle).Widget^.get_allocation(@Allocation);
|
||||||
ARect := Bounds(Allocation.x, Allocation.y, Allocation.width, Allocation.height);
|
ARect := Bounds(Allocation.x, Allocation.y, Allocation.width, Allocation.height);
|
||||||
|
Result := -1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user