mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:04:20 +00:00
* Source/NSMenu.m (windowDidChangeScreen:): simplify calculation of
frame X position.
This commit is contained in:
parent
533be55806
commit
c1c77cc7c0
1 changed files with 4 additions and 5 deletions
|
@ -1875,7 +1875,7 @@ static BOOL menuBarVisible = YES;
|
|||
NSRect frame;
|
||||
NSRect oldScreenFrame;
|
||||
NSRect newScreenFrame;
|
||||
NSPoint offset;
|
||||
CGFloat yOffset;
|
||||
|
||||
if (window == _aWindow
|
||||
|| [window isKeyWindow] == NO
|
||||
|
@ -1890,12 +1890,11 @@ static BOOL menuBarVisible = YES;
|
|||
frame = [_aWindow frame];
|
||||
|
||||
// Keep left offset fixed
|
||||
offset.x = frame.origin.x - oldScreenFrame.origin.x;
|
||||
frame.origin.x = newScreenFrame.origin.x + offset.x;
|
||||
frame.origin.x += newScreenFrame.origin.x - oldScreenFrame.origin.x;
|
||||
|
||||
// Keep top offset fixed
|
||||
offset.y = NSMaxY(oldScreenFrame) - NSMaxY(frame);
|
||||
frame.origin.y = NSMaxY(newScreenFrame) - offset.y - frame.size.height;
|
||||
yOffset = NSMaxY(oldScreenFrame) - NSMaxY(frame);
|
||||
frame.origin.y = NSMaxY(newScreenFrame) - yOffset - frame.size.height;
|
||||
|
||||
// setFrame: changes _screen value.
|
||||
[_aWindow setFrame: frame display: NO];
|
||||
|
|
Loading…
Reference in a new issue