App Nap defers timer firings and I/O if the app is not visibly or audibly updating. An app is supposed to disable it during user-requested or background activity, but we can't know when the Windows app is engaged in such. Since it's not generally acceptable for timers or IO to be deferred, we have to disable it at all times.
The user can re-enable it by setting the following registry setting:
[HKEY\Software\Wine\Mac Driver] "EnableAppNap"="y"
Signed-off-by: Ken Thomases ken@codeweavers.com --- dlls/winemac.drv/cocoa_app.m | 7 +++++++ dlls/winemac.drv/macdrv_cocoa.h | 1 + dlls/winemac.drv/macdrv_main.c | 4 ++++ 3 files changed, 12 insertions(+)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 239c11f..efbd657 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -235,6 +235,13 @@ - (void) transformProcessToForeground
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; [NSApp activateIgnoringOtherApps:YES]; +#if defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 + if (!enable_app_nap && [NSProcessInfo instancesRespondToSelector:@selector(beginActivityWithOptions:reason:)]) + { + [[[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityUserInitiatedAllowingIdleSystemSleep + reason:@"Running Windows program"] retain]; // intentional leak + } +#endif
mainMenu = [[[NSMenu alloc] init] autorelease];
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index acab5df..6bad790 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -166,6 +166,7 @@ extern CFDictionaryRef localized_strings DECLSPEC_HIDDEN; extern int retina_enabled DECLSPEC_HIDDEN; /* Whether Retina mode is enabled via registry setting. */ extern int retina_on DECLSPEC_HIDDEN; /* Whether Retina mode is currently active (enabled and display is in default mode). */ +extern int enable_app_nap DECLSPEC_HIDDEN;
static inline CGRect cgrect_mac_from_win(CGRect rect) { diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 25832b4..6867c62 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -61,6 +61,7 @@ int gl_surface_mode = GL_SURFACE_IN_FRONT_OPAQUE; int retina_enabled = FALSE; HMODULE macdrv_module = 0; BOOL force_backing_store = FALSE; +int enable_app_nap = FALSE;
CFDictionaryRef localized_strings;
@@ -198,6 +199,9 @@ static void setup_options(void) gl_surface_mode = GL_SURFACE_IN_FRONT_OPAQUE; }
+ if (!get_config_key(hkey, appkey, "EnableAppNap", buffer, sizeof(buffer))) + enable_app_nap = IS_OPTION_TRUE(buffer[0]); + if (!get_config_key(hkey, appkey, "ForceOpenGLBackingStore", buffer, sizeof(buffer))) force_backing_store = IS_OPTION_TRUE(buffer[0]);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=39945
Your paranoid android.
=== debian9 (build) === error: patch failed: dlls/winemac.drv/macdrv_main.c:61 Task: Patch failed to apply