mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Merge pull request #95 from frewsxcv/transparent
Implement window transparency on macOS.
This commit is contained in:
commit
3b93c7c664
|
@ -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