mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 03:49:30 +02:00
gtk2: Fix error location in the form Form.Position: = poScreenCenter. Issue #29371
git-svn-id: trunk@51664 -
This commit is contained in:
parent
e727676a1e
commit
08fa33a88d
@ -6141,7 +6141,6 @@ function TGtk2WidgetSet.GetWindowRect(Handle: hwnd; var ARect: TRect): Integer;
|
||||
var
|
||||
Widget: PGTKWidget;
|
||||
GRect: TGdkRectangle;
|
||||
R: TRect;
|
||||
P: TPoint;
|
||||
begin
|
||||
Result := 0; // error
|
||||
@ -6149,14 +6148,14 @@ begin
|
||||
begin
|
||||
Widget := {%H-}PGtkWidget(Handle);
|
||||
|
||||
if GTK_IS_WINDOW(Widget) and Assigned(Widget^.window) then
|
||||
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);
|
||||
R := RectFromGdkRect(GRect);
|
||||
ARect := Bounds(P.X,P.Y,R.Right-R.Left,R.Bottom-R.Top);
|
||||
ARect := Bounds(P.X,P.Y,GRect.width,GRect.height);
|
||||
// writeln('Frame extents are: ',dbgs(R),' ARECT=',dbgs(AREct));
|
||||
Result := 1; // success
|
||||
exit;
|
||||
|
@ -353,6 +353,7 @@ var
|
||||
WindowType: TGtkWindowType;
|
||||
ACustomForm: TCustomForm;
|
||||
AResizable: gint;
|
||||
Allocation: TGtkAllocation;
|
||||
begin
|
||||
// Start of old CreateForm method
|
||||
ACustomForm := TCustomForm(AWinControl);
|
||||
@ -443,6 +444,12 @@ begin
|
||||
if not (csDesigning in AWinControl.ComponentState) then
|
||||
WidgetInfo^.UserData := Pointer(1);
|
||||
|
||||
Allocation.X := AParams.X;
|
||||
Allocation.Y := AParams.Y;
|
||||
Allocation.Width := AParams.Width;
|
||||
Allocation.Height := AParams.Height;
|
||||
gtk_widget_size_allocate(P, @Allocation);
|
||||
|
||||
{$IFDEF DebugLCLComponents}
|
||||
DebugGtkWidgets.MarkCreated(P, dbgsName(AWinControl));
|
||||
{$ENDIF}
|
||||
|
Loading…
Reference in New Issue
Block a user