Reduce OSD flickering

This commit is contained in:
Kamil Trzciński 2022-11-16 01:10:44 +01:00
parent 7a66bb8858
commit 75b47af114
3 changed files with 15 additions and 5 deletions

View file

@ -15,12 +15,23 @@ namespace CommonHelpers
return uint.MaxValue;
var osdSlot = typeof(OSD).GetField("m_osdSlot",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var value = osdSlot.GetValue(osd);
if (value is null)
return uint.MaxValue;
return (uint)value;
}
public static uint OSDIndex(String name)
{
var entries = OSD.GetOSDEntries().ToList();
for (int i = 0; i < entries.Count(); i++)
{
if (entries[i].Owner == name)
return (uint)i;
}
return 0;
}
}
}

View file

@ -204,9 +204,8 @@ namespace PerformanceOverlay
try
{
// recreate OSD if not index 0
if (osd != null && osd.OSDIndex() != 0)
if (OSDHelpers.OSDIndex("PerformanceOverlay") != 0)
osdClose();
if (osd == null)
osd = new OSD("PerformanceOverlay");

View file

@ -266,8 +266,8 @@ namespace PowerControl
try
{
// recreate OSD if not index 0
if (osd != null && osd.OSDIndex() == 0)
// recreate OSD if index 0
if (OSDHelpers.OSDIndex("Power Control") == 0 && OSD.GetOSDCount() > 1)
osdClose();
if (osd == null)
osd = new OSD("Power Control");