Skip to content

Commit

Permalink
never return -1,-1 for position.
Browse files Browse the repository at this point in the history
  • Loading branch information
danwalmsley committed May 19, 2022
1 parent db20d69 commit 24164ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions native/Avalonia.Native/src/OSX/WindowBaseImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ BEGIN_INTERFACE_MAP()
ComPtr<IAvnGlContext> _glContext;
NSObject <IRenderTarget> *renderTarget;
AvnPoint lastPositionSet;
bool hasPosition;
NSSize lastSize;
NSSize lastMinSize;
NSSize lastMaxSize;
Expand Down
7 changes: 4 additions & 3 deletions native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
View = [[AvnView alloc] initWithParent:this];
StandardContainer = [[AutoFitContentView new] initWithContent:View];

lastPositionSet.X = -1;
lastPositionSet.Y = -1;
lastPositionSet = { 0, 0 };
hasPosition = false;
lastSize = NSSize { 100, 100 };
lastMaxSize = NSSize { CGFLOAT_MAX, CGFLOAT_MAX};
lastMinSize = NSSize { 0, 0 };
Expand Down Expand Up @@ -91,7 +91,7 @@
CreateNSWindow(isDialog);
InitialiseNSWindow();

if(lastPositionSet.X >= 0 && lastPositionSet.Y >= 0)
if(hasPosition)
{
SetPosition(lastPositionSet);
}
Expand Down Expand Up @@ -384,6 +384,7 @@

@autoreleasepool {
lastPositionSet = point;
hasPosition = true;

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

0 comments on commit 24164ca

Please sign in to comment.