mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 18:59:21 +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
|
var
|
||||||
Widget: PGTKWidget;
|
Widget: PGTKWidget;
|
||||||
GRect: TGdkRectangle;
|
GRect: TGdkRectangle;
|
||||||
R: TRect;
|
|
||||||
P: TPoint;
|
P: TPoint;
|
||||||
begin
|
begin
|
||||||
Result := 0; // error
|
Result := 0; // error
|
||||||
@ -6149,14 +6148,14 @@ begin
|
|||||||
begin
|
begin
|
||||||
Widget := {%H-}PGtkWidget(Handle);
|
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
|
begin
|
||||||
gdk_window_get_origin(Widget^.window, @ARect.Left, @ARect.Top);
|
gdk_window_get_origin(Widget^.window, @ARect.Left, @ARect.Top);
|
||||||
gdk_window_get_size(Widget^.window, @ARect.Right, @ARect.Bottom);
|
gdk_window_get_size(Widget^.window, @ARect.Right, @ARect.Bottom);
|
||||||
P := GetWidgetOrigin(Widget);
|
P := GetWidgetOrigin(Widget);
|
||||||
gdk_window_get_frame_extents(Widget^.window, @GRect);
|
gdk_window_get_frame_extents(Widget^.window, @GRect);
|
||||||
R := RectFromGdkRect(GRect);
|
ARect := Bounds(P.X,P.Y,GRect.width,GRect.height);
|
||||||
ARect := Bounds(P.X,P.Y,R.Right-R.Left,R.Bottom-R.Top);
|
|
||||||
// writeln('Frame extents are: ',dbgs(R),' ARECT=',dbgs(AREct));
|
// writeln('Frame extents are: ',dbgs(R),' ARECT=',dbgs(AREct));
|
||||||
Result := 1; // success
|
Result := 1; // success
|
||||||
exit;
|
exit;
|
||||||
|
@ -353,6 +353,7 @@ var
|
|||||||
WindowType: TGtkWindowType;
|
WindowType: TGtkWindowType;
|
||||||
ACustomForm: TCustomForm;
|
ACustomForm: TCustomForm;
|
||||||
AResizable: gint;
|
AResizable: gint;
|
||||||
|
Allocation: TGtkAllocation;
|
||||||
begin
|
begin
|
||||||
// Start of old CreateForm method
|
// Start of old CreateForm method
|
||||||
ACustomForm := TCustomForm(AWinControl);
|
ACustomForm := TCustomForm(AWinControl);
|
||||||
@ -443,6 +444,12 @@ begin
|
|||||||
if not (csDesigning in AWinControl.ComponentState) then
|
if not (csDesigning in AWinControl.ComponentState) then
|
||||||
WidgetInfo^.UserData := Pointer(1);
|
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}
|
{$IFDEF DebugLCLComponents}
|
||||||
DebugGtkWidgets.MarkCreated(P, dbgsName(AWinControl));
|
DebugGtkWidgets.MarkCreated(P, dbgsName(AWinControl));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
Loading…
Reference in New Issue
Block a user