Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.
HTML apple-siliconbattle-netcrossover-alternatived3dmetaldiablo-ii-resurrecteddxmtea-appepic-gamesgame-porting-toolkitgogmac-gamingmacosmacos-gamingrockstar-gamessteamubisoft-connectwhisky-alternativewindows-gameswinewine-wrapper
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 2a9dab2..13e054b 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -230,6 +230,34 @@ - (void) transformProcessToForeground:(BOOL)activateIfTransformed
NSString* title;
NSMenuItem* item;
+ /* Soju: suppress Dock icons for processes listed in WINE_NO_DOCK_ICON
+ (semicolon-separated exe names). Modeled on CrossOver's hack 24141. */
+ {
+ const char* nodock = getenv("WINE_NO_DOCK_ICON");
+ if (nodock)
+ {
+ /* The Windows exe path may sit in any argv slot (the loader
+ rewrites argv after NSProcessInfo snapshots it), so match
+ the basename of every argument against the list. */
+ NSArray* list = [[[NSString stringWithUTF8String:nodock] lowercaseString] componentsSeparatedByString:@";"];
+ NSCharacterSet* seps = [NSCharacterSet characterSetWithCharactersInString:@"/\\"];
+ BOOL blocked = NO;
+ NSArray* args = [[NSProcessInfo processInfo] arguments];
+ NSUInteger limit = MIN((NSUInteger)2, args.count);
+ for (NSUInteger i = 0; i < limit; i++)
+ {
+ NSString* base = [[[args[i] componentsSeparatedByCharactersInSet:seps] lastObject] lowercaseString];
+ if (base.length && [list containsObject:base]) { blocked = YES; break; }
+ }
+ if (blocked)
+ {
+ if (activateIfTransformed)
+ [self tryToActivateIgnoringOtherApps:YES];
+ return;
+ }
+ }
+ }
+
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
if (activateIfTransformed)
@@ -2232,6 +2260,40 @@ - (BOOL) applicationShouldHandleReopen:(NSApplication*)theApplication hasVisible
// Note that "flag" is often wrong. WineWindows are NSPanels and NSPanels
// don't count as "visible windows" for this purpose.
[self unminimizeWindowIfNoneVisible];
+
+ /* Soju: WINE_DOCK_REOPEN_CMD: Windows apps that "close to the tray"
+ (Steam) hide their window; there is no tray on macOS, so a Dock click
+ would do nothing. If nothing is visible after the unminimize attempt,
+ run the command (e.g. "steam.exe steam://open/main") to bring it back. */
+ {
+ const char* cmd = getenv("WINE_DOCK_REOPEN_CMD");
+ if (cmd && *cmd)
+ {
+ BOOL anyVisible = NO;
+ for (NSWindow* w in [NSApp windows])
+ {
+ /* Only count windows a user can actually see. Tray-parked apps
+ (Epic Games Launcher) keep tiny transparent helper windows
+ parked far off-screen, and those are still "visible" to AppKit. */
+ if ([w isKindOfClass:[WineWindow class]] && [w isVisible] && ![w isMiniaturized]
+ && [w alphaValue] > 0.0 && w.frame.size.width > 1 && w.frame.size.height > 1)
+ {
+ BOOL onScreen = NO;
+ for (NSScreen* screen in [NSScreen screens])
+ if (NSIntersectsRect(w.frame, screen.frame)) { onScreen = YES; break; }
+ if (onScreen) { anyVisible = YES; break; }
+ }
+ }
+ if (!anyVisible)
+ {
+ NSTask* task = [[NSTask alloc] init];
+ task.launchPath = @"/bin/sh";
+ task.arguments = @[@"-c", [NSString stringWithUTF8String:cmd]];
+ @try { [task launch]; } @catch (NSException* e) { NSLog(@"WINE_DOCK_REOPEN_CMD failed: %@", e); }
+ [task release];
+ }
+ }
+ }
return YES;
}
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -47,6 +47,38 @@
/* CrossOver Hack #16933 */
+
+/* Soju: apps listed in WINE_CUSTOM_FRAME (semicolon-separated exe names) draw
+ * their own title bar inside the client area (Qt/Electron style custom frames,
+ * e.g. GOG GALAXY). Adding a macOS title bar on top of that hides the first
+ * rows of their UI, so such windows get no Cocoa title bar or buttons. */
+static BOOL is_custom_frame_app(void)
+{
+ static int result = -1;
+
+ if (result == -1)
+ {
+ const char *list = getenv("WINE_CUSTOM_FRAME");
+ WCHAR *name = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
+ WCHAR *exe = wcsrchr(name, '\\');
+ char exe_a[MAX_PATH];
+ int i;
+
+ result = 0;
+ exe = exe ? exe + 1 : name;
+ for (i = 0; exe[i] && i < MAX_PATH - 1; i++) exe_a[i] = (char)exe[i];
+ exe_a[i] = 0;
+ while (list && *list)
+ {
+ const char *end = strchr(list, ';');
+ size_t len = end ? (size_t)(end - list) : strlen(list);
+ if (len == strlen(exe_a) && !strncasecmp(list, exe_a, len)) { result = 1; break; }
+ list = end ? end + 1 : NULL;
+ }
+ }
+ return result;
+}
+
static BOOL is_main_quicken_window(HWND hwnd)
{
static const WCHAR qw_exeW[] = {'q','w','.','e','x','e',0};
@@ -127,7 +159,10 @@
return wf;
}
- return get_window_features_for_style(style, ex_style, data->shaped);
+ wf = get_window_features_for_style(style, ex_style, data->shaped);
+ if (wf.title_bar && is_custom_frame_app())
+ wf.title_bar = wf.close_button = wf.minimize_button = wf.maximize_button = FALSE;
+ return wf;
}
@@ -1653,6 +1688,9 @@
/* CW HACK 16933: No Cocoa window decorations for the Quicken main window. */
if (is_main_quicken_window(hwnd)) return FALSE;
+ /* Soju: custom-frame apps keep their caption inside the client area. */
+ if (wf.title_bar && is_custom_frame_app())
+ wf.title_bar = wf.close_button = wf.minimize_button = wf.maximize_button = FALSE;
*style_mask = ex_style = 0;
if (wf.title_bar)