revert: keep macOS main window titlebar opaque

This commit is contained in:
dijunkun
2026-07-28 16:10:24 +08:00
parent c53ce2a581
commit eed90dad34
3 changed files with 5 additions and 17 deletions
+1 -1
View File
@@ -2007,7 +2007,7 @@ void GuiApplication::SyncMainWindow() {
} }
#if defined(__APPLE__) #if defined(__APPLE__)
if (ui_->main_native_titlebar_attempts > 0) { if (ui_->main_native_titlebar_attempts > 0) {
if (ConfigureMainWindowTitlebar()) { if (HideDisabledMainWindowZoomButton()) {
ui_->main_native_titlebar_attempts = 0; ui_->main_native_titlebar_attempts = 0;
} else { } else {
--ui_->main_native_titlebar_attempts; --ui_->main_native_titlebar_attempts;
+3 -4
View File
@@ -8,10 +8,9 @@ namespace crossdesk {
// left-mouse-down event. Returns false when no suitable native event exists. // left-mouse-down event. Returns false when no suitable native event exists.
bool StartNativeWindowDrag(); bool StartNativeWindowDrag();
// Normalizes the native title bar and hides the disabled zoom button on // Hides the disabled native zoom button on CrossDesk's fixed-size main
// CrossDesk's fixed-size main window. Returns true once the matching AppKit // window. Returns true once the matching AppKit window has been configured.
// window has been configured. bool HideDisabledMainWindowZoomButton();
bool ConfigureMainWindowTitlebar();
// Configures live resize and replaces the stream window's native Space // Configures live resize and replaces the stream window's native Space
// fullscreen action with an immediate, single-window fullscreen transition. // fullscreen action with an immediate, single-window fullscreen transition.
+1 -12
View File
@@ -79,7 +79,7 @@ bool StartNativeWindowDrag() {
} }
} }
bool ConfigureMainWindowTitlebar() { bool HideDisabledMainWindowZoomButton() {
@autoreleasepool { @autoreleasepool {
for (NSWindow *window in [NSApp windows]) { for (NSWindow *window in [NSApp windows]) {
if (![window.title isEqualToString:@"CrossDesk"]) { if (![window.title isEqualToString:@"CrossDesk"]) {
@@ -94,17 +94,6 @@ bool ConfigureMainWindowTitlebar() {
continue; continue;
} }
// Slint creates its winit windows with transparency enabled. That makes
// the native title-bar material depend on the SDK used to build the
// Slint runtime. The main window paints an opaque white surface, so make
// the corresponding AppKit window opaque as well and explicitly retain
// the standard, non-overlay title bar.
window.styleMask =
window.styleMask & ~NSWindowStyleMaskFullSizeContentView;
window.titleVisibility = NSWindowTitleVisible;
window.titlebarAppearsTransparent = NO;
window.backgroundColor = NSColor.whiteColor;
window.opaque = YES;
zoom_button.hidden = YES; zoom_button.hidden = YES;
return true; return true;
} }