* Source/NSWindow.m (_applyFrame:): new helper method to do actual

resizing and repositionning.
  (setFrame:display:): use _applyFrame method.
  (applicationDidChangeScreenParameters:): use _applyFrame: method.
This commit is contained in:
Sergii Stoian 2020-03-05 23:27:31 +02:00
parent 3f85f86f3b
commit a61aa9f68f
2 changed files with 30 additions and 29 deletions

View file

@ -1,9 +1,11 @@
2020-03-05 Sergii Stoian <stoyan255@gmail.com> 2020-03-05 Sergii Stoian <stoyan255@gmail.com>
* Source/NSWindow.m (applicationDidChangeScreenParameters:): * Source/NSWindow.m (_applyFrame:): new helper method to do actual
Call backend's `placewindow::` directly because our origin in OpenStep resizing.
coordinates might left unchanged and `setFrame:display:` has check (setFrame:display:): use _applyFrame method.
for it. (applicationDidChangeScreenParameters:): Use _applyFrame: because our
origin in OpenStep coordinates might be unchanged and `setFrame:display:`
has check for it.
2020-02-28 Sergii Stoian <stoyan255@gmail.com> 2020-02-28 Sergii Stoian <stoyan255@gmail.com>

View file

@ -2227,6 +2227,20 @@ titleWithRepresentedFilename(NSString *representedFilename)
[self setFrame: r display: YES]; [self setFrame: r display: YES];
} }
- (void) _applyFrame: (NSRect )frameRect
{
if (_windowNum)
{
[GSServerForWindow(self) placewindow: frameRect : _windowNum];
}
else
{
_frame = frameRect;
frameRect.origin = NSZeroPoint;
[_wv setFrame: frameRect];
}
}
- (void) setFrame: (NSRect)frameRect display: (BOOL)flag - (void) setFrame: (NSRect)frameRect display: (BOOL)flag
{ {
if (_maximumSize.width > 0 && frameRect.size.width > _maximumSize.width) if (_maximumSize.width > 0 && frameRect.size.width > _maximumSize.width)
@ -2265,14 +2279,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
* Now we can tell the graphics context to do the actual resizing. * Now we can tell the graphics context to do the actual resizing.
* We will recieve an event to tell us when the resize is done. * We will recieve an event to tell us when the resize is done.
*/ */
if (_windowNum) [self _applyFrame: frameRect];
[GSServerForWindow(self) placewindow: frameRect : _windowNum];
else
{
_frame = frameRect;
frameRect.origin = NSZeroPoint;
[_wv setFrame: frameRect];
}
if (flag) if (flag)
[self display]; [self display];
@ -2495,7 +2502,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
} }
- (void) update - (void) update
{ {
[nc postNotificationName: NSWindowDidUpdateNotification object: self]; [nc postNotificationName: NSWindowDidUpdateNotification object: self];
} }
@ -2738,23 +2745,15 @@ titleWithRepresentedFilename(NSString *representedFilename)
// Screen X origin change. Screen width change shouldn't affect our frame. // Screen X origin change. Screen width change shouldn't affect our frame.
newFrame.origin.x += newScreenFrame.origin.x - oldScreenFrame.origin.x; newFrame.origin.x += newScreenFrame.origin.x - oldScreenFrame.origin.x;
if (_windowNum) /* Call backend's `placewindow::` directly because our origin in OpenStep
coordinates might be unchanged and `setFrame:display:` has check
for it. */
[self _applyFrame: newFrame];
[self display];
if (_autosaveName != nil)
{ {
/* Call backend's `placewindow::` directly because our origin in OpenStep [self saveFrameUsingName: _autosaveName];
coordinates might left unchanged and `setFrame:display:` has check
for it. */
[GSServerForWindow(self) placewindow: newFrame : _windowNum];
if (_autosaveName != nil)
{
[self saveFrameUsingName: _autosaveName];
}
[self display];
}
else
{
_frame = newFrame;
newFrame.origin = NSZeroPoint;
[_wv setFrame: newFrame];
} }
} }