mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 11:31:00 +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
9904b6ad6b
commit
091e43b9fe
2 changed files with 46 additions and 27 deletions
|
@ -61,9 +61,14 @@
|
||||||
enum {
|
enum {
|
||||||
NSNormalWindowLevel = 0,
|
NSNormalWindowLevel = 0,
|
||||||
NSFloatingWindowLevel = 3,
|
NSFloatingWindowLevel = 3,
|
||||||
NSDockWindowLevel = 5,
|
NSSubmenuWindowLevel = 3,
|
||||||
NSSubmenuWindowLevel = 10,
|
NSTornOffMenuWindowLevel = 3,
|
||||||
NSMainMenuWindowLevel = 20
|
NSDockWindowLevel = 5, /* Deprecated - use NSStatusWindowLevel */
|
||||||
|
NSMainMenuWindowLevel = 20,
|
||||||
|
NSStatusWindowLevel = 21,
|
||||||
|
NSModalPanelWindowLevel = 100,
|
||||||
|
NSPopUpMenuWindowLevel = 101,
|
||||||
|
NSScreenSaverWindowLevel = 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -70,9 +70,10 @@
|
||||||
* Types
|
* Types
|
||||||
*/
|
*/
|
||||||
struct _NSModalSession {
|
struct _NSModalSession {
|
||||||
int runState;
|
int runState;
|
||||||
NSWindow *window;
|
int entryLevel;
|
||||||
NSModalSession previous;
|
NSWindow *window;
|
||||||
|
NSModalSession previous;
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface NSIconWindow : NSWindow
|
@interface NSIconWindow : NSWindow
|
||||||
|
@ -885,16 +886,41 @@ static NSCell* tileCell = nil;
|
||||||
theSession = (NSModalSession)NSZoneMalloc(NSDefaultMallocZone(),
|
theSession = (NSModalSession)NSZoneMalloc(NSDefaultMallocZone(),
|
||||||
sizeof(struct _NSModalSession));
|
sizeof(struct _NSModalSession));
|
||||||
theSession->runState = NSRunContinuesResponse;
|
theSession->runState = NSRunContinuesResponse;
|
||||||
|
theSession->entryLevel = [theWindow level];
|
||||||
theSession->window = theWindow;
|
theSession->window = theWindow;
|
||||||
theSession->previous = session;
|
theSession->previous = session;
|
||||||
session = theSession;
|
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;
|
return theSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) endModalSession: (NSModalSession)theSession
|
- (void) endModalSession: (NSModalSession)theSession
|
||||||
{
|
{
|
||||||
NSModalSession tmp = session;
|
NSModalSession tmp = session;
|
||||||
|
NSArray *windows = [self windows];
|
||||||
|
|
||||||
if (theSession == 0)
|
if (theSession == 0)
|
||||||
{
|
{
|
||||||
|
@ -915,9 +941,17 @@ static NSCell* tileCell = nil;
|
||||||
{
|
{
|
||||||
tmp = session;
|
tmp = session;
|
||||||
session = tmp->previous;
|
session = tmp->previous;
|
||||||
|
if ([windows indexOfObjectIdenticalTo: tmp->window] != NSNotFound)
|
||||||
|
{
|
||||||
|
[tmp->window setLevel: tmp->entryLevel];
|
||||||
|
}
|
||||||
NSZoneFree(NSDefaultMallocZone(), tmp);
|
NSZoneFree(NSDefaultMallocZone(), tmp);
|
||||||
}
|
}
|
||||||
session = session->previous;
|
session = session->previous;
|
||||||
|
if ([windows indexOfObjectIdenticalTo: theSession->window] != NSNotFound)
|
||||||
|
{
|
||||||
|
[theSession->window setLevel: theSession->entryLevel];
|
||||||
|
}
|
||||||
NSZoneFree(NSDefaultMallocZone(), theSession);
|
NSZoneFree(NSDefaultMallocZone(), theSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -926,26 +960,6 @@ static NSCell* tileCell = nil;
|
||||||
NSModalSession theSession = 0;
|
NSModalSession theSession = 0;
|
||||||
int code = NSRunContinuesResponse;
|
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
|
NS_DURING
|
||||||
{
|
{
|
||||||
theSession = [self beginModalSessionForWindow: theWindow];
|
theSession = [self beginModalSessionForWindow: theWindow];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue