mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-22 10:42:29 +01:00
Add native Mac bridge code for window level settings
This commit is contained in:
parent
2b3c69c1c6
commit
ba7d04c034
@ -0,0 +1,30 @@
|
||||
#include "macbridge.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <objc/runtime.h>
|
||||
#include <QApplication>
|
||||
#include <QWindow>
|
||||
|
||||
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];
|
||||
}
|
@ -1,4 +1,15 @@
|
||||
#ifndef MACBRIDGE_H
|
||||
#define MACBRIDGE_H
|
||||
#pragma once
|
||||
|
||||
#endif // MACBRIDGE_H
|
||||
#include <QApplication>
|
||||
|
||||
class MacBridge : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
static MacBridge* bridge;
|
||||
MacBridge();
|
||||
public:
|
||||
static MacBridge* instance();
|
||||
static void SetBackgroundLevel(QWindow* window);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user