mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 22:53:15 -04:00
Don't set the background color when initializing with transparency (#3657)
Setting the background color changes how the window title bar appears, which is something that the application should customize itself if it wants this behaviour (and also, it wasn't set when calling `set_transparent`, so the behaviour wasn't consistent).
This commit is contained in:
@@ -137,7 +137,6 @@ features = [
|
||||
"NSApplication",
|
||||
"NSBitmapImageRep",
|
||||
"NSButton",
|
||||
"NSColor",
|
||||
"NSControl",
|
||||
"NSCursor",
|
||||
"NSDragging",
|
||||
|
||||
@@ -260,3 +260,4 @@ changelog entry.
|
||||
- On Wayland, fix decoration glitch on close with some compositors.
|
||||
- On Android, fix a regression introduced in #2748 to allow volume key events to be received again.
|
||||
- On Windows, don't return a valid window handle outside of the GUI thread.
|
||||
- On macOS, don't set the background color when initializing a window with transparency.
|
||||
|
||||
@@ -12,7 +12,7 @@ use objc2::{
|
||||
};
|
||||
use objc2_app_kit::{
|
||||
NSAppKitVersionNumber, NSAppKitVersionNumber10_12, NSAppearance, NSApplication,
|
||||
NSApplicationPresentationOptions, NSBackingStoreType, NSColor, NSDraggingDestination,
|
||||
NSApplicationPresentationOptions, NSBackingStoreType, NSDraggingDestination,
|
||||
NSFilenamesPboardType, NSPasteboard, NSRequestUserAttentionType, NSScreen, NSView,
|
||||
NSWindowButton, NSWindowDelegate, NSWindowFullScreenButton, NSWindowLevel,
|
||||
NSWindowOcclusionState, NSWindowOrderingMode, NSWindowSharingType, NSWindowStyleMask,
|
||||
@@ -605,7 +605,6 @@ fn new_window(attrs: &WindowAttributes, mtm: MainThreadMarker) -> Option<Id<Wini
|
||||
|
||||
if attrs.transparent {
|
||||
window.setOpaque(false);
|
||||
window.setBackgroundColor(Some(unsafe { &NSColor::clearColor() }));
|
||||
}
|
||||
|
||||
// register for drag and drop operations.
|
||||
|
||||
@@ -941,6 +941,8 @@ impl Window {
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - **macOS:** If you're not drawing to the window yourself, you might have to set the
|
||||
/// background color of the window to enable transparency.
|
||||
/// - **Web / iOS / Android:** Unsupported.
|
||||
/// - **X11:** Can only be set while building the window, with
|
||||
/// [`WindowAttributes::with_transparent`].
|
||||
|
||||
Reference in New Issue
Block a user