Skip to content

Commit 24164ca

Browse files
committed
never return -1,-1 for position.
1 parent db20d69 commit 24164ca

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

native/Avalonia.Native/src/OSX/WindowBaseImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ BEGIN_INTERFACE_MAP()
3535
ComPtr<IAvnGlContext> _glContext;
3636
NSObject <IRenderTarget> *renderTarget;
3737
AvnPoint lastPositionSet;
38+
bool hasPosition;
3839
NSSize lastSize;
3940
NSSize lastMinSize;
4041
NSSize lastMaxSize;

native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
View = [[AvnView alloc] initWithParent:this];
3030
StandardContainer = [[AutoFitContentView new] initWithContent:View];
3131

32-
lastPositionSet.X = -1;
33-
lastPositionSet.Y = -1;
32+
lastPositionSet = { 0, 0 };
33+
hasPosition = false;
3434
lastSize = NSSize { 100, 100 };
3535
lastMaxSize = NSSize { CGFLOAT_MAX, CGFLOAT_MAX};
3636
lastMinSize = NSSize { 0, 0 };
@@ -91,7 +91,7 @@
9191
CreateNSWindow(isDialog);
9292
InitialiseNSWindow();
9393

94-
if(lastPositionSet.X >= 0 && lastPositionSet.Y >= 0)
94+
if(hasPosition)
9595
{
9696
SetPosition(lastPositionSet);
9797
}
@@ -384,6 +384,7 @@
384384

385385
@autoreleasepool {
386386
lastPositionSet = point;
387+
hasPosition = true;
387388

388389
if(Window != nullptr) {
389390
[Window setFrameTopLeftPoint:ToNSPoint(ConvertPointY(point))];

0 commit comments

Comments
 (0)