File tree Expand file tree Collapse file tree 3 files changed +10
-23
lines changed
native/Avalonia.Native/src/OSX Expand file tree Collapse file tree 3 files changed +10
-23
lines changed Original file line number Diff line number Diff line change @@ -33,23 +33,6 @@ virtual NSWindowStyleMask GetStyle() override
33
33
return NSWindowStyleMaskBorderless;
34
34
}
35
35
36
- virtual HRESULT Resize (double x, double y, AvnPlatformResizeReason reason) override
37
- {
38
- START_COM_CALL;
39
-
40
- @autoreleasepool
41
- {
42
- if (Window != nullptr )
43
- {
44
- [Window setContentSize: NSSize {x, y}];
45
-
46
- [Window setFrameTopLeftPoint: ToNSPoint (ConvertPointY (lastPositionSet))];
47
- }
48
-
49
- return S_OK;
50
- }
51
- }
52
-
53
36
public:
54
37
virtual bool ShouldTakeFocusOnShow () override
55
38
{
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ BEGIN_INTERFACE_MAP()
35
35
ComPtr<IAvnGlContext> _glContext;
36
36
NSObject <IRenderTarget> *renderTarget;
37
37
AvnPoint lastPositionSet;
38
+ bool hasPosition;
38
39
NSSize lastSize;
39
40
NSSize lastMinSize;
40
41
NSSize lastMaxSize;
Original file line number Diff line number Diff line change 29
29
View = [[AvnView alloc ] initWithParent: this ];
30
30
StandardContainer = [[AutoFitContentView new ] initWithContent: View];
31
31
32
- lastPositionSet. X = - 1 ;
33
- lastPositionSet. Y = - 1 ;
32
+ lastPositionSet = { 0 , 0 } ;
33
+ hasPosition = false ;
34
34
lastSize = NSSize { 100 , 100 };
35
35
lastMaxSize = NSSize { CGFLOAT_MAX, CGFLOAT_MAX};
36
36
lastMinSize = NSSize { 0 , 0 };
91
91
CreateNSWindow (isDialog);
92
92
InitialiseNSWindow ();
93
93
94
- if (lastPositionSet. X >= 0 && lastPositionSet. Y >= 0 )
94
+ if (hasPosition )
95
95
{
96
96
SetPosition (lastPositionSet);
97
+ } else
98
+ {
99
+ [Window center ];
97
100
}
98
101
99
102
UpdateStyle ();
287
290
}
288
291
289
292
@try {
293
+ lastSize = NSSize {x, y};
294
+
290
295
if (!_shown) {
291
296
BaseEvents->Resized (AvnSize{x, y}, reason);
292
297
}
293
298
294
- lastSize = NSSize {x, y};
295
-
296
299
if (Window != nullptr ) {
297
300
[Window setContentSize: lastSize];
298
301
}
384
387
385
388
@autoreleasepool {
386
389
lastPositionSet = point;
390
+ hasPosition = true ;
387
391
388
392
if (Window != nullptr ) {
389
393
[Window setFrameTopLeftPoint: ToNSPoint (ConvertPointY (point))];
576
580
[Window setContentMaxSize: lastMaxSize];
577
581
578
582
[Window setOpaque: false ];
579
- [Window center ];
580
583
581
584
if (lastMenu != nullptr ) {
582
585
[GetWindowProtocol () applyMenu: lastMenu];
You can’t perform that action at this time.
0 commit comments