UI tweaks

This commit is contained in:
Serge
2023-05-22 17:57:06 +02:00
parent 9e6ca7c2e2
commit 5b2a4cb065
3 changed files with 35 additions and 10 deletions

View File

@@ -319,7 +319,15 @@ namespace GHelper
private void Keyboard_Shown(object? sender, EventArgs e)
{
Top = Program.settingsForm.Top;
if (Height > Program.settingsForm.Height)
{
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
}
else
{
Top = Program.settingsForm.Top;
}
Left = Program.settingsForm.Left - Width - 5;
}

View File

@@ -709,6 +709,15 @@ public class NativeMethods
dm.dmDisplayFrequency = frequency;
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
// Retry as refresh rate can fail sometimes
if (iRet == -1)
{
Thread.Sleep(500);
iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
}
return iRet;
}

View File

@@ -282,8 +282,13 @@ namespace GHelper
if (Program.acpi.DeviceGet(AsusACPI.GPUXG) == 1)
{
Program.acpi.DeviceSet(AsusACPI.GPUXG, 0, "GPU XGM");
await Task.Delay(TimeSpan.FromSeconds(15));
KillGPUApps();
DialogResult dialogResult = MessageBox.Show("Did you close all applications running on XG Mobile?", "Disabling XG Mobile", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
Program.acpi.DeviceSet(AsusACPI.GPUXG, 0, "GPU XGM");
await Task.Delay(TimeSpan.FromSeconds(15));
}
}
else
{
@@ -516,7 +521,7 @@ namespace GHelper
}
m.Result = (IntPtr)1;
break;
case KeyHandler.WM_HOTKEY_MSG_ID:
Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF);
@@ -1491,6 +1496,14 @@ namespace GHelper
}
protected static void KillGPUApps()
{
string[] tokill = { "EADesktop", "RadeonSoftware", "epicgameslauncher" };
foreach (string kill in tokill)
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
}
public void SetGPUEco(int eco, bool hardWay = false)
{
@@ -1507,12 +1520,7 @@ namespace GHelper
int status;
if (eco == 1)
{
string[] tokill = { "EADesktop", "RadeonSoftware" };
foreach (string kill in tokill)
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
}
if (eco == 1) KillGPUApps();
//if (eco == 1) status = 0; else
status = Program.acpi.SetGPUEco(eco);