Introduced a thread sleep to ClearWindow method

This is to alleviate race conditions where the command sent to clear whatevers previously drawn on a redraw isn't acknowledged til after the redraw, immediately clearing whatever was drawn.
There's probably a better way of doing this - but this works for now.
This commit is contained in:
Bailey Eaton 2023-06-02 13:38:32 +10:00
parent 8579fb6932
commit de648a72bc

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading;
namespace TED.Utils namespace TED.Utils
{ {
@ -117,8 +118,9 @@ namespace TED.Utils
// The Thread.Sleep() is necessary because the command has a minor delay to it // The Thread.Sleep() is necessary because the command has a minor delay to it
// Without it, the clear will end up running after we've generated a watermark, // Without it, the clear will end up running after we've generated a watermark,
// removing our newly generated watermark // removing our newly generated watermark
// Surely there's a better way to do this but for now... this works okay?
SendMessage(windowHandle, 0x0034, 4, IntPtr.Zero); SendMessage(windowHandle, 0x0034, 4, IntPtr.Zero);
//Thread.Sleep(2000); Thread.Sleep(2000);
} }
public static IntPtr CreateWorkerW(IntPtr progman) public static IntPtr CreateWorkerW(IntPtr progman)