Skip to content

Commit

Permalink
imp - Don't refresh on mouse move in the homepage
Browse files Browse the repository at this point in the history
---

We need not to refresh the homepage upon moving the mouse.

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 4, 2024
1 parent c23181a commit 7eb2544
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion public/Nitrocid/Shell/Homepage/HomepageTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,20 @@ [new InputChoiceInfo(Translate.DoTranslation("Close"), Translate.DoTranslation("
// Render the thing and wait for a keypress
bool exiting = false;
bool render = true;
while (!exiting)
{
// Render and wait for input for a second
ScreenTools.Render();
if (render)
{
ScreenTools.Render();
render = false;
}
if (!SpinWait.SpinUntil(() => Input.InputAvailable, 1000))
{
render = true;
continue;
}
// Read the available input
if (Input.MouseInputAvailable)
Expand Down Expand Up @@ -334,6 +342,7 @@ [new InputChoiceInfo(Translate.DoTranslation("Close"), Translate.DoTranslation("
{
if (context.ButtonPress == PointerButtonPress.Released && context.Button == PointerButton.Left)
SettingsApp.OpenMainPage(Config.MainConfig);
render = true;
}
else if (isWithinOptions)
{
Expand All @@ -349,6 +358,7 @@ [new InputChoiceInfo(Translate.DoTranslation("Close"), Translate.DoTranslation("
if (context.ButtonPress == PointerButtonPress.Released && context.Button == PointerButton.Left)
DoAction(choiceIdx);
}
render = true;
}
else if (context.ButtonPress == PointerButtonPress.Scrolled)
{
Expand All @@ -357,20 +367,26 @@ [new InputChoiceInfo(Translate.DoTranslation("Close"), Translate.DoTranslation("
choiceIdx--;
if (choiceIdx < 0)
choiceIdx++;
render = true;
}
else if (context.Button == PointerButton.WheelDown)
{
choiceIdx++;
if (choiceIdx >= choices.Length)
choiceIdx--;
render = true;
}
}
}
if (context.ButtonPress == PointerButtonPress.Moved)
{
settingsHighlighted = isWithinSettings;
render = true;
}
}
else if (ConsoleWrapper.KeyAvailable && !Input.PointerActive)
{
render = true;
var keypress = Input.ReadKey();
switch (keypress.Key)
{
Expand Down Expand Up @@ -430,6 +446,9 @@ [new InputChoiceInfo(Translate.DoTranslation("Close"), Translate.DoTranslation("
KernelColorTools.GetColor(KernelColorType.TuiBoxForeground),
KernelColorTools.GetColor(KernelColorType.TuiBoxBackground));
break;
default:
render = false;
break;
}
}
}
Expand Down

0 comments on commit 7eb2544

Please sign in to comment.