mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Standard mode fix
This commit is contained in:
@@ -238,7 +238,7 @@ namespace GHelper.Display
|
|||||||
//Fallback scenario
|
//Fallback scenario
|
||||||
if (iRet != 0)
|
if (iRet != 0)
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(500);
|
||||||
iRet = ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
iRet = ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
||||||
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
|
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAutoToggleClamshellMode.Visible = clamshellControl.IsExternalDisplayConnected();
|
//checkAutoToggleClamshellMode.Visible = clamshellControl.IsExternalDisplayConnected();
|
||||||
checkAutoToggleClamshellMode.Checked = AppConfig.Is("toggle_clamshell_mode");
|
checkAutoToggleClamshellMode.Checked = AppConfig.Is("toggle_clamshell_mode");
|
||||||
checkAutoToggleClamshellMode.CheckedChanged += checkAutoToggleClamshellMode_CheckedChanged;
|
checkAutoToggleClamshellMode.CheckedChanged += checkAutoToggleClamshellMode_CheckedChanged;
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ namespace GHelper.Gpu
|
|||||||
{
|
{
|
||||||
|
|
||||||
bool GpuAuto = AppConfig.Is("gpu_auto");
|
bool GpuAuto = AppConfig.Is("gpu_auto");
|
||||||
bool ForceGPU = AppConfig.ContainsModel("503");
|
bool ForceGPU = AppConfig.ContainsModel("503") || AppConfig.Is("gpu_fix");
|
||||||
|
|
||||||
int GpuMode = AppConfig.Get("gpu_mode");
|
int GpuMode = AppConfig.Get("gpu_mode");
|
||||||
|
|
||||||
@@ -321,5 +321,16 @@ namespace GHelper.Gpu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Manually forcing standard mode on shutdown/hibernate for some exotic cases
|
||||||
|
// https://github.com/seerge/g-helper/pull/855
|
||||||
|
public void StandardModeFix()
|
||||||
|
{
|
||||||
|
if (!AppConfig.Is("gpu_fix")) return; // No config entry
|
||||||
|
if (Program.acpi.DeviceGet(AsusACPI.GPUMux) == 0) return; // Ultimate mode
|
||||||
|
|
||||||
|
Logger.WriteLine("Forcing Standard Mode on shutdown / hibernation");
|
||||||
|
Program.acpi.SetGPUEco(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ namespace GHelper
|
|||||||
// Subscribing for system power change events
|
// Subscribing for system power change events
|
||||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||||
|
|
||||||
|
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
|
||||||
|
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
|
||||||
|
|
||||||
clamshellControl.RegisterDisplayEvents();
|
clamshellControl.RegisterDisplayEvents();
|
||||||
clamshellControl.ToggleLidAction();
|
clamshellControl.ToggleLidAction();
|
||||||
|
|
||||||
@@ -117,7 +121,19 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
|
||||||
|
{
|
||||||
|
gpuControl.StandardModeFix();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock)
|
||||||
|
{
|
||||||
|
Logger.WriteLine("Session:" + e.Reason.ToString());
|
||||||
|
screenControl.AutoScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
static void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -178,8 +194,12 @@ namespace GHelper
|
|||||||
|
|
||||||
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Logger.WriteLine("Power Mode:" + e.Mode.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
if (e.Mode == PowerModes.Suspend) gpuControl.StandardModeFix();
|
||||||
|
|
||||||
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
|
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
|
||||||
Logger.WriteLine("Power Mode Changed");
|
|
||||||
SetAutoModes(true);
|
SetAutoModes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user