Fixed window levels in OS X Cocoa (STR #2316)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7102 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
3b7e794719
commit
b416a027cf
1
CHANGES
1
CHANGES
@ -1,5 +1,6 @@
|
||||
CHANGES IN FLTK 1.3.0
|
||||
|
||||
- Fixed window levels in OS X Cocoa (STR #2316)
|
||||
- Added jpeg support to Fluid image() element
|
||||
- Added loading jpeg images from memory
|
||||
- Added binary data type to Fluid
|
||||
|
@ -1301,6 +1301,8 @@ extern "C" {
|
||||
- (void)windowDidMiniaturize:(NSNotification *)notif;
|
||||
- (void)windowWillClose:(NSNotification *)notif;
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender;
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)notify;
|
||||
- (void)applicationWillResignActive:(NSNotification *)notify;
|
||||
|
||||
@end
|
||||
@implementation FLDelegate
|
||||
@ -1389,6 +1391,83 @@ extern "C" {
|
||||
fl_unlock_function();
|
||||
return reply;
|
||||
}
|
||||
/**
|
||||
* Cocoa organizes the Z depth of windows on a global priority. FLTK however
|
||||
* expectes the window manager to organize Z level by application. The trickery
|
||||
* below will change Z order during activation and deactivation.
|
||||
*/
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)notify
|
||||
{
|
||||
Fl_X *x;
|
||||
FLWindow *top = 0, *topModal = 0, *topNonModal = 0;
|
||||
for (x = Fl_X::first;x;x = x->next) {
|
||||
FLWindow *cw = (FLWindow*)x->xid;
|
||||
Fl_Window *win = x->w;
|
||||
if (win && cw) {
|
||||
if (win->modal()) {
|
||||
[cw setLevel:NSModalPanelWindowLevel];
|
||||
if (topModal)
|
||||
[cw orderWindow:NSWindowBelow relativeTo:[topModal windowNumber]];
|
||||
else
|
||||
topModal = cw;
|
||||
} else if (win->non_modal()) {
|
||||
[cw setLevel:NSFloatingWindowLevel];
|
||||
if (topNonModal)
|
||||
[cw orderWindow:NSWindowBelow relativeTo:[topNonModal windowNumber]];
|
||||
else
|
||||
topNonModal = cw;
|
||||
} else {
|
||||
if (top)
|
||||
;
|
||||
else
|
||||
top = cw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)applicationWillResignActive:(NSNotification *)notify
|
||||
{
|
||||
Fl_X *x;
|
||||
FLWindow *top = 0;
|
||||
// sort in all regular windows
|
||||
for (x = Fl_X::first;x;x = x->next) {
|
||||
FLWindow *cw = (FLWindow*)x->xid;
|
||||
Fl_Window *win = x->w;
|
||||
if (win && cw) {
|
||||
if (win->modal()) {
|
||||
} else if (win->non_modal()) {
|
||||
} else {
|
||||
if (!top) top = cw;
|
||||
}
|
||||
}
|
||||
}
|
||||
// now sort in all modals
|
||||
for (x = Fl_X::first;x;x = x->next) {
|
||||
FLWindow *cw = (FLWindow*)x->xid;
|
||||
Fl_Window *win = x->w;
|
||||
if (win && cw) {
|
||||
if (win->modal()) {
|
||||
[cw setLevel:NSNormalWindowLevel];
|
||||
if (top) [cw orderWindow:NSWindowAbove relativeTo:[top windowNumber]];
|
||||
} else if (win->non_modal()) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
// finally all non-modals
|
||||
for (x = Fl_X::first;x;x = x->next) {
|
||||
FLWindow *cw = (FLWindow*)x->xid;
|
||||
Fl_Window *win = x->w;
|
||||
if (win && cw) {
|
||||
if (win->modal()) {
|
||||
} else if (win->non_modal()) {
|
||||
[cw setLevel:NSNormalWindowLevel];
|
||||
if (top) [cw orderWindow:NSWindowAbove relativeTo:[top windowNumber]];
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
@interface FLApplication : NSApplication
|
||||
|
Loading…
x
Reference in New Issue
Block a user