Skip to content

Commit

Permalink
Option to override minimum refresh rate #3261
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Oct 14, 2024
1 parent ecbd926 commit 45709eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/Display/ScreenControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class ScreenControl
{

public const int MAX_REFRESH = 1000;

public static int MIN_RATE = AppConfig.Get("min_rate", 60);

public void AutoScreen(bool force = false)
{
Expand All @@ -15,7 +15,7 @@ public void AutoScreen(bool force = false)
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
SetScreen(MAX_REFRESH, 1);
else
SetScreen(60, 0);
SetScreen(MIN_RATE, 0);
}
else
{
Expand All @@ -29,7 +29,7 @@ public void ToggleScreenRate()
var refreshRate = ScreenNative.GetRefreshRate(laptopScreen);
if (refreshRate < 0) return;

ScreenNative.SetRefreshRate(laptopScreen, refreshRate > 60 ? 60 : ScreenNative.GetMaxRefreshRate(laptopScreen));
ScreenNative.SetRefreshRate(laptopScreen, refreshRate > MIN_RATE ? MIN_RATE : ScreenNative.GetMaxRefreshRate(laptopScreen));
InitScreen();
}

Expand Down
14 changes: 8 additions & 6 deletions app/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ private void Button120Hz_MouseHover(object? sender, EventArgs e)

private void Button60Hz_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = Properties.Strings.MinRefreshTooltip;
labelTipScreen.Text = Properties.Strings.MinRefreshTooltip.Replace("60", ScreenControl.MIN_RATE.ToString());
}

private void ButtonScreen_MouseLeave(object? sender, EventArgs e)
Expand All @@ -860,7 +860,7 @@ private void ButtonScreen_MouseLeave(object? sender, EventArgs e)

private void ButtonScreenAuto_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = Properties.Strings.AutoRefreshTooltip;
labelTipScreen.Text = Properties.Strings.AutoRefreshTooltip.Replace("60", ScreenControl.MIN_RATE.ToString());
}

private void ButtonUltimate_MouseHover(object? sender, EventArgs e)
Expand Down Expand Up @@ -1215,7 +1215,7 @@ private void Button120Hz_Click(object? sender, EventArgs e)
private void Button60Hz_Click(object? sender, EventArgs e)
{
AppConfig.Set("screen_auto", 0);
screenControl.SetScreen(60, 0);
screenControl.SetScreen(ScreenControl.MIN_RATE, 0);
}


Expand Down Expand Up @@ -1246,16 +1246,18 @@ public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency,
{
buttonScreenAuto.Activated = true;
}
else if (frequency == 60)
else if (frequency == ScreenControl.MIN_RATE)
{
button60Hz.Activated = true;
}
else if (frequency > 60)
else if (frequency > ScreenControl.MIN_RATE)
{
button120Hz.Activated = true;
}

if (maxFrequency > 60)
button60Hz.Text = ScreenControl.MIN_RATE + "Hz";

if (maxFrequency > ScreenControl.MIN_RATE)
{
button120Hz.Text = maxFrequency.ToString() + "Hz" + (overdriveSetting ? " + OD" : "");
panelScreen.Visible = true;
Expand Down

0 comments on commit 45709eb

Please sign in to comment.