mirror of https://github.com/odrling/Aegisub
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:
parent
f0f7ad2858
commit
8c17d45e8c
|
@ -20,6 +20,7 @@ LDFLAGS += $(LDFLAGS_CCMALLOC)
|
||||||
|
|
||||||
ifeq (yes, $(BUILD_DARWIN))
|
ifeq (yes, $(BUILD_DARWIN))
|
||||||
SRC += osx_utils.mm
|
SRC += osx_utils.mm
|
||||||
|
osx_utils.o: OBJCXXFLAGS += -fobjc-arc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -23,20 +23,42 @@
|
||||||
|
|
||||||
#include "config.h"
|
#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>
|
#include <wx/window.h>
|
||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
void AddFullScreenButton(wxWindow *window) {
|
void AddFullScreenButton(wxWindow *window) {
|
||||||
NSWindow *nsWindow = [window->GetHandle() window];
|
NSWindow *nsWindow = [window->GetHandle() window];
|
||||||
if (![nsWindow respondsToSelector:@selector(toggleFullScreen:)])
|
if (![nsWindow respondsToSelector:@selector(toggleFullScreen:)])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSWindowCollectionBehavior collectionBehavior = [nsWindow collectionBehavior];
|
NSWindowCollectionBehavior collectionBehavior = [nsWindow collectionBehavior];
|
||||||
collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
||||||
[nsWindow setCollectionBehavior:collectionBehavior];
|
[nsWindow setCollectionBehavior:collectionBehavior];
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFloatOnParent(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]; }];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue