Skip to content

Commit

Permalink
Potential fix for changing resolutions too often
Browse files Browse the repository at this point in the history
  • Loading branch information
juv committed Jul 30, 2017
1 parent a527f0d commit be20c78
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions vibrance.GUI/NVIDIA/NvidiaDynamicVibranceProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,17 @@ private static void OnWinEventHook(object sender, WinEventHookEventArgs e)
{
ApplicationSetting applicationSetting = _applicationSettings.FirstOrDefault(x => x.Name.Equals(e.ProcessName));
if (applicationSetting != null)
{
//test if a resolution change is needed
Screen screen = Screen.FromHandle(e.Handle);
if (applicationSetting.IsResolutionChangeNeeded && IsResolutionChangeNeeded(screen, applicationSetting.ResolutionSettings))
{
PerformResolutionChange(screen, applicationSetting.ResolutionSettings);
}

//test if changing the vibrance value is needed
{
int displayHandle = GetApplicationDisplayHandle(e.Handle);
//test if changing the vibrance value is needed
if (displayHandle != -1 && !equalsDVCLevel(displayHandle, applicationSetting.IngameLevel))
{
//test if a resolution change is needed
Screen screen = Screen.FromHandle(e.Handle);
if (applicationSetting.IsResolutionChangeNeeded && IsResolutionChangeNeeded(screen, applicationSetting.ResolutionSettings))
{
PerformResolutionChange(screen, applicationSetting.ResolutionSettings);
}
_gameScreen = screen;
_vibranceInfo.defaultHandle = displayHandle;
setDVCLevel(_vibranceInfo.defaultHandle, applicationSetting.IngameLevel);
Expand Down

1 comment on commit be20c78

@juv
Copy link
Owner Author

@juv juv commented on be20c78 Jul 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #36

Please sign in to comment.