Tell OS about window title

This commit is contained in:
Julia 2023-02-15 15:55:55 -05:00
parent afb375f909
commit e56dfd9177

View file

@ -19,7 +19,7 @@ use cocoa::{
appkit::{ appkit::{
CGPoint, NSApplication, NSBackingStoreBuffered, NSScreen, NSView, NSViewHeightSizable, CGPoint, NSApplication, NSBackingStoreBuffered, NSScreen, NSView, NSViewHeightSizable,
NSViewWidthSizable, NSWindow, NSWindowButton, NSWindowCollectionBehavior, NSViewWidthSizable, NSWindow, NSWindowButton, NSWindowCollectionBehavior,
NSWindowStyleMask, NSWindowStyleMask, NSWindowTitleVisibility,
}, },
base::{id, nil}, base::{id, nil},
foundation::{NSAutoreleasePool, NSInteger, NSPoint, NSRect, NSSize, NSString, NSUInteger}, foundation::{NSAutoreleasePool, NSInteger, NSPoint, NSRect, NSSize, NSString, NSUInteger},
@ -536,6 +536,7 @@ impl Window {
.map_or(true, |titlebar| titlebar.appears_transparent) .map_or(true, |titlebar| titlebar.appears_transparent)
{ {
native_window.setTitlebarAppearsTransparent_(YES); native_window.setTitlebarAppearsTransparent_(YES);
native_window.setTitleVisibility_(NSWindowTitleVisibility::NSWindowTitleHidden);
} }
native_view.setAutoresizingMask_(NSViewWidthSizable | NSViewHeightSizable); native_view.setAutoresizingMask_(NSViewWidthSizable | NSViewHeightSizable);
@ -734,7 +735,8 @@ impl platform::Window for Window {
let app = NSApplication::sharedApplication(nil); let app = NSApplication::sharedApplication(nil);
let window = self.0.borrow().native_window; let window = self.0.borrow().native_window;
let title = ns_string(title); let title = ns_string(title);
msg_send![app, changeWindowsItem:window title:title filename:false] let _: () = msg_send![app, changeWindowsItem:window title:title filename:false];
let _: () = msg_send![window, setTitle: title];
} }
} }