Commit 250944b6 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Disable macOS's App Nap energy-saving feature by default for Wine GUI processes.

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: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 650997d7
......@@ -235,6 +235,13 @@ static NSString* WineLocalizedString(unsigned int stringID)
[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];
......
......@@ -166,6 +166,7 @@ extern int gl_surface_mode DECLSPEC_HIDDEN;
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)
{
......
......@@ -60,6 +60,7 @@ int use_precise_scrolling = TRUE;
int gl_surface_mode = GL_SURFACE_IN_FRONT_OPAQUE;
int retina_enabled = FALSE;
HMODULE macdrv_module = 0;
int enable_app_nap = FALSE;
CFDictionaryRef localized_strings;
......@@ -197,6 +198,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]);
/* Don't use appkey. The DPI and monitor sizes should be consistent for all
processes in the prefix. */
if (!get_config_key(hkey, NULL, "RetinaMode", buffer, sizeof(buffer)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment