diff --git a/ScreenPlayWindow/src/MacBridge.mm b/ScreenPlayWindow/src/MacBridge.mm index e69de29b..0a36010a 100644 --- a/ScreenPlayWindow/src/MacBridge.mm +++ b/ScreenPlayWindow/src/MacBridge.mm @@ -0,0 +1,30 @@ +#include "macbridge.h" +#import +#import +#include +#include + +MacBridge * MacBridge::bridge = NULL; + +MacBridge::MacBridge() +{ + +} + +MacBridge * MacBridge::instance() +{ + if(!bridge) + bridge = new MacBridge; + return bridge; +} + +void MacBridge::SetBackgroundLevel(QWindow* window) +{ + NSView* view = (NSView *) window->winId(); + NSWindow* nsWindow = (NSWindow*)[view window]; + + [nsWindow setLevel:CGWindowLevelForKey(kCGDesktopWindowLevelKey) + 1]; + [nsWindow setBackgroundColor: [NSColor blackColor]]; + [nsWindow setAcceptsMouseMovedEvents: false]; + [nsWindow setMovableByWindowBackground: false]; +} diff --git a/ScreenPlayWindow/src/macbridge.h b/ScreenPlayWindow/src/macbridge.h index 922655aa..b572807f 100644 --- a/ScreenPlayWindow/src/macbridge.h +++ b/ScreenPlayWindow/src/macbridge.h @@ -1,4 +1,15 @@ -#ifndef MACBRIDGE_H -#define MACBRIDGE_H +#pragma once -#endif // MACBRIDGE_H +#include + +class MacBridge : public QObject +{ + Q_OBJECT + +private: + static MacBridge* bridge; + MacBridge(); +public: + static MacBridge* instance(); + static void SetBackgroundLevel(QWindow* window); +};