+/* Check whether a button (VK_*BUTTON) is currently depressed. Returns
+ * non-zero (not necessarily 1) if yes. */
+static SHORT fgGetAsyncKeyState(int vKey)
+{
+ /* MSDN says: "If the most significant bit is set, the key is down, and if
+ * the least significant bit is set, the key was pressed after the previous
+ * call to GetAsyncKeyState." This behavior cannot be relied upon however.
+ * Remove this bit so that we can simply test with ! if key is up.
+ */
+ return GetAsyncKeyState(vKey) & ~1;
+}
+