0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00

Merge pull request #2386 from tbodt/mac-panels

UI: Add Chromium-compatible NSApplication subclass
This commit is contained in:
Jim 2020-02-09 16:32:54 -08:00 committed by GitHub
commit 6a561f7ae8
2 changed files with 33 additions and 0 deletions

View File

@ -1761,6 +1761,10 @@ static int run_program(fstream &logFile, int argc, char *argv[])
QCoreApplication::addLibraryPath(".");
#if __APPLE__
InstallNSApplicationSubclass();
#endif
OBSApp program(argc, argv, profilerNameStore.get());
try {
bool created_log = false;

View File

@ -196,3 +196,32 @@ void EnableOSXDockIcon(bool enable)
[NSApp setActivationPolicy:
NSApplicationActivationPolicyProhibited];
}
/*
* This custom NSApplication subclass makes the app compatible with CEF. Qt
* also has an NSApplication subclass, but it doesn't conflict thanks to Qt
* using arcane magic to hook into the NSApplication superclass itself if the
* program has its own NSApplication subclass.
*/
@protocol CrAppProtocol
- (BOOL)isHandlingSendEvent;
@end
@interface OBSApplication : NSApplication <CrAppProtocol>
@property (nonatomic, getter=isHandlingSendEvent) BOOL handlingSendEvent;
@end
@implementation OBSApplication
- (void)sendEvent:(NSEvent *)event
{
_handlingSendEvent = YES;
[super sendEvent:event];
_handlingSendEvent = NO;
}
@end
void InstallNSApplicationSubclass()
{
[OBSApplication sharedApplication];
}