mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-28 08:49:32 +00:00
make rootless window overlay everything else
This commit is contained in:
parent
f6616d1d4d
commit
68fcaa117b
@ -75,10 +75,26 @@ void make_window_transparent(SDL_Window * window)
|
||||
CALayer *maskLayer = [CAShapeLayer layer];
|
||||
sdlView.layer.mask = maskLayer;
|
||||
SDL_SetWindowData(window, "maskLayer", maskLayer);
|
||||
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserverForName:NSWindowDidBecomeKeyNotification object:cocoaWindow queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
||||
NSWindow *window = (NSWindow*)note.object;
|
||||
window.level = NSMainMenuWindowLevel+1;
|
||||
}];
|
||||
[nc addObserverForName:NSWindowDidResignKeyNotification object:cocoaWindow queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
||||
NSWindow *window = (NSWindow*)note.object;
|
||||
// hack for window to be sent behind new key window
|
||||
[window setIsVisible:NO];
|
||||
[window setLevel:NSNormalWindowLevel];
|
||||
[window setIsVisible:YES];
|
||||
}];
|
||||
}
|
||||
cocoaWindow.backgroundColor = [NSColor clearColor];
|
||||
cocoaWindow.hasShadow = NO;
|
||||
cocoaWindow.opaque = NO;
|
||||
if (cocoaWindow.isKeyWindow) {
|
||||
cocoaWindow.level = NSMainMenuWindowLevel+1;
|
||||
}
|
||||
|
||||
// make metal layer transparent
|
||||
for (NSView *view in sdlView.subviews) {
|
||||
|
Loading…
Reference in New Issue
Block a user