* 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>
* Source/NSWindow.m (applicationDidChangeScreenParameters:):
Call backend's `placewindow::` directly because our origin in OpenStep
coordinates might left unchanged and `setFrame:display:` has check
for it.
* Source/NSWindow.m (_applyFrame:): new helper method to do actual
resizing.
(setFrame:display:): use _applyFrame method.
(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>

View file

@ -2227,6 +2227,20 @@ titleWithRepresentedFilename(NSString *representedFilename)
[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
{
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.
* We will recieve an event to tell us when the resize is done.
*/
if (_windowNum)
[GSServerForWindow(self) placewindow: frameRect : _windowNum];
else
{
_frame = frameRect;
frameRect.origin = NSZeroPoint;
[_wv setFrame: frameRect];
}
[self _applyFrame: frameRect];
if (flag)
[self display];
@ -2495,7 +2502,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
}
- (void) update
{
{
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
}
@ -2738,23 +2745,15 @@ titleWithRepresentedFilename(NSString *representedFilename)
// Screen X origin change. Screen width change shouldn't affect our frame.
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
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];
[self saveFrameUsingName: _autosaveName];
}
}