mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +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]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
objc = "0.2"
|
objc = "0.2"
|
||||||
cgl = "0.1"
|
cgl = "0.1"
|
||||||
cocoa = "0.5.0"
|
cocoa = "0.5.2"
|
||||||
core-foundation = "0"
|
core-foundation = "0"
|
||||||
core-graphics = "0.4"
|
core-graphics = "0.4"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use objc::declare::ClassDecl;
|
||||||
use cocoa::base::{id, nil};
|
use cocoa::base::{id, nil};
|
||||||
use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize,
|
use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize,
|
||||||
NSString, NSUInteger};
|
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};
|
use core_graphics::display::{CGAssociateMouseAndMouseCursorPosition, CGMainDisplayID, CGDisplayPixelsHigh, CGWarpMouseCursorPosition};
|
||||||
|
|
||||||
|
@ -287,7 +287,8 @@ impl Window {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if win_attribs.transparent {
|
if win_attribs.transparent {
|
||||||
unimplemented!();
|
(*window as id).setOpaque_(NO);
|
||||||
|
(*window as id).setBackgroundColor_(NSColor::clearColor(nil));
|
||||||
}
|
}
|
||||||
|
|
||||||
app.activateIgnoringOtherApps_(YES);
|
app.activateIgnoringOtherApps_(YES);
|
||||||
|
|
Loading…
Reference in a new issue