mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 13:31:29 +11:00
Implement window transparency on macOS.
Fixes https://github.com/tomaka/winit/issues/57.
This commit is contained in:
parent
13620118f6
commit
cb0811faf3
|
@ -26,7 +26,7 @@ objc = "0.2"
|
|||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
objc = "0.2"
|
||||
cgl = "0.1"
|
||||
cocoa = "0.5.0"
|
||||
cocoa = "0.5.2"
|
||||
core-foundation = "0"
|
||||
core-graphics = "0.4"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use objc::declare::ClassDecl;
|
|||
use cocoa::base::{id, nil};
|
||||
use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize,
|
||||
NSString, NSUInteger};
|
||||
use cocoa::appkit::{self, NSApplication, NSEvent, NSView, NSWindow};
|
||||
use cocoa::appkit::{self, NSApplication, NSColor, NSEvent, NSView, NSWindow};
|
||||
|
||||
use core_graphics::display::{CGAssociateMouseAndMouseCursorPosition, CGMainDisplayID, CGDisplayPixelsHigh, CGWarpMouseCursorPosition};
|
||||
|
||||
|
@ -287,7 +287,8 @@ impl Window {
|
|||
|
||||
unsafe {
|
||||
if win_attribs.transparent {
|
||||
unimplemented!();
|
||||
(*window as id).setOpaque_(NO);
|
||||
(*window as id).setBackgroundColor_(NSColor::clearColor(nil));
|
||||
}
|
||||
|
||||
app.activateIgnoringOtherApps_(YES);
|
||||
|
|
Loading…
Reference in a new issue