osx: Move the detached video dialog to the normal window level when it goes fullscreen as it's hilariously broken otherwise

Originally committed to SVN as r6890.
This commit is contained in:
Thomas Goyne 2012-06-07 21:03:08 +00:00
parent f0f7ad2858
commit 8c17d45e8c
2 changed files with 30 additions and 7 deletions

View File

@ -20,6 +20,7 @@ LDFLAGS += $(LDFLAGS_CCMALLOC)
ifeq (yes, $(BUILD_DARWIN))
SRC += osx_utils.mm
osx_utils.o: OBJCXXFLAGS += -fobjc-arc
endif
###############

View File

@ -23,6 +23,14 @@
#include "config.h"
// This bit of awfulness is to disable some ARC-incompatible stuff in window.h
// that we don't need
#include <wx/brush.h>
#undef wxOSX_USE_COCOA_OR_IPHONE
#define wxOSX_USE_COCOA_OR_IPHONE 0
class WXDLLIMPEXP_FWD_CORE wxWidgetImpl;
typedef wxWidgetImpl wxOSXWidgetImpl;
#include <wx/window.h>
#import <AppKit/AppKit.h>
@ -38,5 +46,19 @@ void AddFullScreenButton(wxWindow *window) {
}
void SetFloatOnParent(wxWindow *window) {
[[window->GetHandle() window] setLevel:NSFloatingWindowLevel];
__unsafe_unretained NSWindow *nsWindow = [window->GetHandle() window];
[nsWindow setLevel:NSFloatingWindowLevel];
if (!([nsWindow collectionBehavior] & NSWindowCollectionBehaviorFullScreenPrimary))
return;
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserverForName:@"NSWindowWillEnterFullScreenNotification"
object:nsWindow
queue:nil
usingBlock:^(NSNotification *) { [nsWindow setLevel:NSNormalWindowLevel]; }];
[nc addObserverForName:@"NSWindowWillExitFullScreenNotification"
object:nsWindow
queue:nil
usingBlock:^(NSNotification *) { [nsWindow setLevel:NSFloatingWindowLevel]; }];
}