aboutsummaryrefslogtreecommitdiff
path: root/scripts/windows_input
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/windows_input')
-rw-r--r--scripts/windows_input/Native.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/windows_input/Native.cs b/scripts/windows_input/Native.cs
index 42b387b1..76cb8af7 100644
--- a/scripts/windows_input/Native.cs
+++ b/scripts/windows_input/Native.cs
@@ -389,7 +389,7 @@ namespace HerdrInputGauntlet {
[DllImport("kernel32.dll")] static extern bool SetConsoleCP(uint cp);
[DllImport("kernel32.dll")] static extern bool ReadFile(IntPtr handle,byte[] buffer,uint size,out uint count,IntPtr overlap);
[DllImport("kernel32.dll")] static extern bool WriteFile(IntPtr handle,byte[] buffer,uint size,out uint count,IntPtr overlap);
- [DllImport("kernel32.dll")] static extern bool ReadConsoleInputW(IntPtr handle,Record[] records,uint size,out uint count);
+ [DllImport("kernel32.dll")] static extern bool ReadConsoleInputW(IntPtr handle,[Out] Record[] records,uint size,out uint count);
[DllImport("kernel32.dll")] static extern uint GetCurrentThreadId();
[DllImport("kernel32.dll")] static extern IntPtr OpenThread(uint access,bool inherit,uint id);
[DllImport("kernel32.dll")] static extern bool CancelSynchronousIo(IntPtr thread);
@@ -459,7 +459,11 @@ namespace HerdrInputGauntlet {
public void Clear() { lock(gate) { bytes.Clear(); records.Clear(); } }
public bool ClearIfCount(int expected) {
lock(gate) {
- if(bytes.Count+records.Count!=expected) return false;
+ if(bytes.Count+records.Count!=expected) {
+ if(!native || bytes.Count!=0 || records.Count<expected) return false;
+ for(int i=expected;i<records.Count;i++)
+ if(records[i][0]!=4 && records[i][0]!=16) return false; // resize/focus between captures
+ }
bytes.Clear(); records.Clear(); return true;
}
}