summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/fpg_base.pas19
-rw-r--r--src/corelib/fpg_widget.pas6
-rw-r--r--src/corelib/gdi/fpg_gdi.pas19
-rw-r--r--src/corelib/x11/fpg_x11.pas20
4 files changed, 30 insertions, 34 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index 214744e9..2fb97580 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -1211,9 +1211,7 @@ procedure TfpgWindowBase.HandleMove(x, y: TfpgCoord);
begin
if FTop <> y then
begin
- // if we don't have a handle we are still setting up, so actual value and
- // previous value must be the same.
- if HasHandle then
+ if not (csLoading in ComponentState) then
FPrevTop := FTop
else
FPrevTop := y;
@@ -1223,9 +1221,7 @@ begin
if FLeft <> x then
begin
- // if we don't have a handle we are still setting up, so actual value and
- // previous value must be the same.
- if HasHandle then
+ if not (csLoading in ComponentState) then
FPrevLeft := FHeight
else
FPrevLeft := x;
@@ -1238,9 +1234,7 @@ procedure TfpgWindowBase.HandleResize(AWidth, AHeight: TfpgCoord);
begin
if FWidth <> AWidth then
begin
- // if we don't have a handle we are still setting up, so actual value and
- // previous value must be the same.
- if HasHandle then
+ if not (csLoading in ComponentState) then
FPrevWidth := FWidth
else
FPrevWidth := AWidth;
@@ -1250,9 +1244,7 @@ begin
if FHeight <> AHeight then
begin
- // if we don't have a handle we are still setting up, so actual value and
- // previous value must be the same.
- if HasHandle then
+ if not (csLoading in ComponentState) then
FPrevHeight := FHeight
else
FPrevHeight := AHeight;
@@ -1305,8 +1297,7 @@ end;
procedure TfpgWindowBase.UpdateWindowPosition;
begin
- if HasHandle then
- DoUpdateWindowPosition;
+ DoUpdateWindowPosition;
end;
procedure TfpgWindowBase.MoveWindow(const x: TfpgCoord; const y: TfpgCoord);
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas
index e13806be..7c728380 100644
--- a/src/corelib/fpg_widget.pas
+++ b/src/corelib/fpg_widget.pas
@@ -371,14 +371,14 @@ begin
{$IFDEF CStackDebug}
itf := DebugMethodEnter('TfpgWidget.DoUpdateWindowPosition - ' + ClassName + ' ('+Name+')');
{$ENDIF}
-// writeln('DoUpdateWindowPosition - ', Classname);
+// writeln('TfpgWidget.DoUpdateWindowPosition - ' + Classname + ' ('+Name+')');
dw := FWidth - FPrevWidth;
dh := FHeight - FPrevHeight;
if IsContainer and FSizeIsDirty then
begin
{$IFDEF CStackDebug}
- DebugLn(Format('w: %d h: %d', [dw, dh]));
+ DebugLn(Format(' Alignment deltas w: %d h: %d', [dw, dh]));
{$ENDIF}
HandleAlignments(dw, dh);
end;
@@ -1334,7 +1334,7 @@ begin
itf := DebugMethodEnter('TfpgWidget.MoveAndResize');
DebugLn(Format('Class:%s t:%d l:%d w:%d h:%d', [Classname, ATop, ALeft, AWidth, aHeight]));
{$ENDIF}
- if not (csLoading in ComponentState) {HasHandle} then
+ if not (csLoading in ComponentState) then
begin
if (ALeft <> FLeft) or (ATop <> FTop) then
HandleMove(ALeft, ATop);
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index 6d1ff0c7..9eb9f952 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -1976,14 +1976,17 @@ procedure TfpgGDIWindow.DoUpdateWindowPosition;
var
bx, by: integer;
begin
- FSkipResizeMessage := True;
- GetWindowBorderDimensions(Self, bx, by);
- Windows.SetWindowPos(
- WinHandle, HWND_TOP,
- FLeft, FTop, FWidth + bx, FHeight + by,
- SWP_NOZORDER);// or SWP_NOREDRAW);
- Windows.InvalidateRect(WinHandle, nil, True);
- FSkipResizeMessage := False;
+ if HasHandle then
+ begin
+ FSkipResizeMessage := True;
+ GetWindowBorderDimensions(Self, bx, by);
+ Windows.SetWindowPos(
+ WinHandle, HWND_TOP,
+ FLeft, FTop, FWidth + bx, FHeight + by,
+ SWP_NOZORDER);// or SWP_NOREDRAW);
+ Windows.InvalidateRect(WinHandle, nil, True);
+ FSkipResizeMessage := False;
+ end;
end;
{ TfpgGDICanvas }
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index 8ae27ec1..ab41dc6b 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -2348,17 +2348,19 @@ var
w: longword;
h: longword;
begin
- if FWidth > 1 then
- w := FWidth
- else
- w := 1;
- if FHeight > 1 then
- h := FHeight
- else
- h := 1;
+ if HasHandle then
+ begin
+ if FWidth > 1 then
+ w := FWidth
+ else
+ w := 1;
+ if FHeight > 1 then
+ h := FHeight
+ else
+ h := 1;
- if FWinHandle > 0 then
XMoveResizeWindow(xapplication.display, FWinHandle, FLeft, FTop, w, h);
+ end;
end;
procedure TfpgX11Window.DoSetMouseCursor;