mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
* Source/GSTitleView.m (mouseDown:): limit menu movement to screen
frame for top/left/right edges. Menu can be moved to the bottom until title is completely visible.
This commit is contained in:
parent
31d06161d5
commit
a7aa7d014d
2 changed files with 33 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2020-01-31 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/GSTitleView.m (mouseDown:): limit menu movement to screen
|
||||
frame for top/left/right edges. Menu can be moved to the bottom until
|
||||
title is completely visible.
|
||||
|
||||
2020-01-27 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSWindow.m (applicationDidChangeScreenParameters): take into
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
Author: Serg Stoyan <stoyan@on.com.ua>
|
||||
Author: Sergii Stoian <stoyan255@gmail.com>
|
||||
Date: Mar 2003
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
@ -41,6 +41,7 @@
|
|||
#import "AppKit/NSStringDrawing.h"
|
||||
#import "AppKit/NSView.h"
|
||||
#import "AppKit/NSWindow.h"
|
||||
#import "AppKit/NSScreen.h"
|
||||
|
||||
#import "GNUstepGUI/GSTitleView.h"
|
||||
#import "GNUstepGUI/GSTheme.h"
|
||||
|
@ -238,9 +239,24 @@
|
|||
NSDate *theDistantFuture = [NSDate distantFuture];
|
||||
NSPoint startWindowOrigin;
|
||||
NSPoint endWindowOrigin;
|
||||
CGFloat leftLimit;
|
||||
CGFloat topLimit;
|
||||
CGFloat rightLimit;
|
||||
CGFloat bottomLimit;
|
||||
|
||||
NSDebugLLog (@"NSMenu", @"Mouse down in title!");
|
||||
|
||||
// Define move constrains for menu
|
||||
if (_ownedByMenu)
|
||||
{
|
||||
NSRect screenFrame = [[NSScreen mainScreen] frame];
|
||||
leftLimit = screenFrame.origin.x;
|
||||
topLimit = NSMaxY(screenFrame) - [_window frame].size.height;
|
||||
rightLimit = NSMaxX(screenFrame) - [_window frame].size.width;
|
||||
bottomLimit = screenFrame.origin.y -
|
||||
([_window frame].size.height - [self frame].size.height);
|
||||
}
|
||||
|
||||
// Remember start position of window
|
||||
startWindowOrigin = [_window frame].origin;
|
||||
|
||||
|
@ -275,6 +291,16 @@
|
|||
origin.y += (location.y - lastLocation.y);
|
||||
if (_ownedByMenu)
|
||||
{
|
||||
if (origin.x <= leftLimit)
|
||||
origin.x = leftLimit;
|
||||
else if (origin.x >= rightLimit)
|
||||
origin.x = rightLimit;
|
||||
|
||||
if (origin.y >= topLimit)
|
||||
origin.y = topLimit;
|
||||
else if (origin.y <= bottomLimit)
|
||||
origin.y = bottomLimit;
|
||||
|
||||
[_owner nestedSetFrameOrigin: origin];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue