From 1c5e46131f7d7e724027dcc9701e095411d25c6b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 3 Oct 2023 18:35:48 +0200 Subject: [PATCH 1/3] Tray icon click fix --- app/Settings.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Settings.cs b/app/Settings.cs index 181a8b06..8851f94e 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -39,6 +39,7 @@ namespace GHelper static long lastRefresh; static long lastBatteryRefresh; + static long lastLostFocus; bool isGpuSection = true; @@ -88,6 +89,7 @@ namespace GHelper buttonUpdates.Text = Properties.Strings.Updates; FormClosing += SettingsForm_FormClosing; + Deactivate += SettingsForm_LostFocus; buttonSilent.BorderColor = colorEco; buttonBalanced.BorderColor = colorStandard; @@ -212,6 +214,11 @@ namespace GHelper panelPerformance.Focus(); } + private void SettingsForm_LostFocus(object? sender, EventArgs e) + { + lastLostFocus = DateTimeOffset.Now.ToUnixTimeMilliseconds(); + } + private void ButtonBatteryFull_Click(object? sender, EventArgs e) { BatteryControl.ToggleBatteryLimitFull(); @@ -881,7 +888,8 @@ namespace GHelper (extraForm != null && extraForm.ContainsFocus) || (updatesForm != null && updatesForm.ContainsFocus) || (matrixForm != null && matrixForm.ContainsFocus) || - this.ContainsFocus; + this.ContainsFocus || + Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastLostFocus) < 300; } private void SettingsForm_FormClosing(object? sender, FormClosingEventArgs e) From 7a4d885e1b37f47555a8e9c89bbe0a17d5cb8305 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 4 Oct 2023 10:29:03 +0200 Subject: [PATCH 2/3] Fn-lock fix https://github.com/seerge/g-helper/issues/1413 --- app/AppConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index dcedd42a..eccbff03 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -327,7 +327,7 @@ public static class AppConfig // Devices with bugged bios command to change brightness public static bool SwappedBrightness() { - return ContainsModel("FA506IH") || ContainsModel("FX506LU"); + return ContainsModel("FA506IH") || ContainsModel("FX506LU") || ContainsModel("FX506IC"); } From 6232fb1cfbcdfa77aafad95719fbf6e6cfc6c75e Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Wed, 4 Oct 2023 13:10:26 +0200 Subject: [PATCH 3/3] Support for TUF Gaming M5 Mouse. (#1414) --- app/Peripherals/Mouse/Models/TUFM5.cs | 170 +++++++++++++++++++++++++ app/Peripherals/PeripheralsProvider.cs | 1 + 2 files changed, 171 insertions(+) create mode 100644 app/Peripherals/Mouse/Models/TUFM5.cs diff --git a/app/Peripherals/Mouse/Models/TUFM5.cs b/app/Peripherals/Mouse/Models/TUFM5.cs new file mode 100644 index 00000000..f1574598 --- /dev/null +++ b/app/Peripherals/Mouse/Models/TUFM5.cs @@ -0,0 +1,170 @@ +namespace GHelper.Peripherals.Mouse.Models +{ + //P304 + public class TUFM5 : AsusMouse + { + public TUFM5() : base(0x0B05, 0x1898, "mi_02", false) + { + } + + public override int DPIProfileCount() + { + return 2; + } + + public override string GetDisplayName() + { + return "TUF GAMING M5"; + } + + + public override PollingRate[] SupportedPollingrates() + { + return new PollingRate[] { + PollingRate.PR125Hz, + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; + } + + //Mouse has React mapped to 0x03 instead of 0x04 like other mice + protected override byte IndexForLightingMode(LightingMode lightingMode) + { + if (lightingMode == LightingMode.React) + { + return 0x03; + } + return ((byte)lightingMode); + } + + //Mouse has React mapped to 0x03 instead of 0x04 like other mice + protected override LightingMode LightingModeForIndex(byte lightingMode) + { + if (lightingMode == 0x03) + { + return LightingMode.React; + } + return base.LightingModeForIndex(lightingMode); + + } + + public override int ProfileCount() + { + return 1; + } + public override int MaxDPI() + { + return 6_200; + } + public override bool HasBattery() + { + return false; + } + + public override bool HasLiftOffSetting() + { + return false; + } + public override LightingZone[] SupportedLightingZones() + { + return new LightingZone[] { LightingZone.Logo }; + } + + public override bool HasRGB() + { + return true; + } + + public override bool HasAngleSnapping() + { + return true; + } + + public override int DPIIncrements() + { + return 100; + } + + public override bool CanChangeDPIProfile() + { + return true; + } + + public override bool HasDebounceSetting() + { + return true; + } + + public override int MaxBrightness() + { + return 4; + } + + public override bool IsLightingModeSupported(LightingMode lightingMode) + { + return lightingMode == LightingMode.Static + || lightingMode == LightingMode.Breathing + || lightingMode == LightingMode.ColorCycle + || lightingMode == LightingMode.React; + } + + + protected override byte[] GetUpdatePollingRatePacket(PollingRate pollingRate) + { + return new byte[] { reportId, 0x51, 0x31, 0x02, 0x00, (byte)pollingRate }; + } + + protected override byte[] GetUpdateAngleSnappingPacket(bool angleSnapping) + { + return new byte[] { reportId, 0x51, 0x31, 0x04, 0x00, (byte)(angleSnapping ? 0x01 : 0x00) }; + } + + protected override PollingRate ParsePollingRate(byte[] packet) + { + + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return (PollingRate)packet[9]; + } + + return PollingRate.PR125Hz; + } + + protected override bool ParseAngleSnapping(byte[] packet) + { + + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return packet[13] == 0x01; + } + + return false; + } + + protected override byte[] GetUpdateDebouncePacket(DebounceTime debounce) + { + return new byte[] { reportId, 0x51, 0x31, 0x03, 0x00, ((byte)debounce) }; + } + + protected override DebounceTime ParseDebounce(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x04 || packet[3] != 0x00) + { + return DebounceTime.MS12; + } + + if (packet[11] < 0x02) + { + return DebounceTime.MS12; + } + + if (packet[11] > 0x07) + { + return DebounceTime.MS32; + } + + return (DebounceTime)packet[11]; + } + } +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 781c8207..11b93eae 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -200,6 +200,7 @@ namespace GHelper.Peripherals DetectMouse(new HarpeAceAimLabEditionWired()); DetectMouse(new HarpeAceAimLabEditionOmni()); DetectMouse(new TUFM3()); + DetectMouse(new TUFM5()); DetectMouse(new KerisWirelssAimpoint()); DetectMouse(new KerisWirelssAimpointWired()); DetectMouse(new PugioII());