mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
window level fixes in modal sessions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5604 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9ddf15fcaf
commit
2bc9a218d4
2 changed files with 46 additions and 27 deletions
|
@ -61,9 +61,14 @@
|
|||
enum {
|
||||
NSNormalWindowLevel = 0,
|
||||
NSFloatingWindowLevel = 3,
|
||||
NSDockWindowLevel = 5,
|
||||
NSSubmenuWindowLevel = 10,
|
||||
NSMainMenuWindowLevel = 20
|
||||
NSSubmenuWindowLevel = 3,
|
||||
NSTornOffMenuWindowLevel = 3,
|
||||
NSDockWindowLevel = 5, /* Deprecated - use NSStatusWindowLevel */
|
||||
NSMainMenuWindowLevel = 20,
|
||||
NSStatusWindowLevel = 21,
|
||||
NSModalPanelWindowLevel = 100,
|
||||
NSPopUpMenuWindowLevel = 101,
|
||||
NSScreenSaverWindowLevel = 1000
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -70,9 +70,10 @@
|
|||
* Types
|
||||
*/
|
||||
struct _NSModalSession {
|
||||
int runState;
|
||||
NSWindow *window;
|
||||
NSModalSession previous;
|
||||
int runState;
|
||||
int entryLevel;
|
||||
NSWindow *window;
|
||||
NSModalSession previous;
|
||||
};
|
||||
|
||||
@interface NSIconWindow : NSWindow
|
||||
|
@ -885,16 +886,41 @@ static NSCell* tileCell = nil;
|
|||
theSession = (NSModalSession)NSZoneMalloc(NSDefaultMallocZone(),
|
||||
sizeof(struct _NSModalSession));
|
||||
theSession->runState = NSRunContinuesResponse;
|
||||
theSession->entryLevel = [theWindow level];
|
||||
theSession->window = theWindow;
|
||||
theSession->previous = session;
|
||||
session = theSession;
|
||||
|
||||
/*
|
||||
* The NSWindow documentation says runModalForWindow centers panels.
|
||||
* Here would seem the best place to do it.
|
||||
*/
|
||||
if ([theWindow isKindOfClass: [NSPanel class]])
|
||||
{
|
||||
[theWindow center];
|
||||
// FIXME need support for NSModalPanelWindowLevel in Window Maker
|
||||
// [theWindow setLevel: NSModalPanelWindowLevel];
|
||||
}
|
||||
[theWindow orderFrontRegardless];
|
||||
if ([self isActive] == YES)
|
||||
{
|
||||
if ([theWindow canBecomeKeyWindow] == YES)
|
||||
{
|
||||
[theWindow makeKeyWindow];
|
||||
}
|
||||
else if ([theWindow canBecomeMainWindow] == YES)
|
||||
{
|
||||
[theWindow makeMainWindow];
|
||||
}
|
||||
}
|
||||
|
||||
return theSession;
|
||||
}
|
||||
|
||||
- (void) endModalSession: (NSModalSession)theSession
|
||||
{
|
||||
NSModalSession tmp = session;
|
||||
NSModalSession tmp = session;
|
||||
NSArray *windows = [self windows];
|
||||
|
||||
if (theSession == 0)
|
||||
{
|
||||
|
@ -915,9 +941,17 @@ static NSCell* tileCell = nil;
|
|||
{
|
||||
tmp = session;
|
||||
session = tmp->previous;
|
||||
if ([windows indexOfObjectIdenticalTo: tmp->window] != NSNotFound)
|
||||
{
|
||||
[tmp->window setLevel: tmp->entryLevel];
|
||||
}
|
||||
NSZoneFree(NSDefaultMallocZone(), tmp);
|
||||
}
|
||||
session = session->previous;
|
||||
if ([windows indexOfObjectIdenticalTo: theSession->window] != NSNotFound)
|
||||
{
|
||||
[theSession->window setLevel: theSession->entryLevel];
|
||||
}
|
||||
NSZoneFree(NSDefaultMallocZone(), theSession);
|
||||
}
|
||||
|
||||
|
@ -926,26 +960,6 @@ static NSCell* tileCell = nil;
|
|||
NSModalSession theSession = 0;
|
||||
int code = NSRunContinuesResponse;
|
||||
|
||||
/*
|
||||
* The NSWindow documentation says runModalForWindow centers panels.
|
||||
*/
|
||||
if ([theWindow isKindOfClass: [NSPanel class]])
|
||||
{
|
||||
[theWindow center];
|
||||
}
|
||||
[theWindow orderFrontRegardless];
|
||||
if ([self isActive] == YES)
|
||||
{
|
||||
if ([theWindow canBecomeKeyWindow] == YES)
|
||||
{
|
||||
[theWindow makeKeyWindow];
|
||||
}
|
||||
else if ([theWindow canBecomeMainWindow] == YES)
|
||||
{
|
||||
[theWindow makeMainWindow];
|
||||
}
|
||||
}
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
theSession = [self beginModalSessionForWindow: theWindow];
|
||||
|
|
Loading…
Reference in a new issue