+ keymap_t *km = map_get(key2vk,key);
+ return km ? km->vk : toupper(key);
+}
+
+static mod_t getmod(void)
+{
+ return (mod_t){
+ .alt = GetKeyState(VK_MENU) < 0,
+ .ctrl = GetKeyState(VK_CONTROL) < 0,
+ .shift = GetKeyState(VK_SHIFT) < 0,
+ .win = GetKeyState(VK_LWIN) < 0 ||
+ GetKeyState(VK_RWIN) < 0,
+ };
+}
+
+/* - Pointers */
+static ptr_t getptr(void)
+{
+ POINT wptr;
+ GetCursorPos(&wptr);
+ return (ptr_t){-1, -1, wptr.x, wptr.y};
+}
+
+/* Helpers */
+static win_t *win_new(HWND hwnd, int checkwin)
+{
+ if (checkwin) {
+ char winclass[256];
+ int exstyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ GetClassName(hwnd, winclass, sizeof(winclass));
+ if (!IsWindowVisible(hwnd)) return NULL; // Invisible stuff..
+ if (!strcmp("#32770", winclass)) return NULL; // Message boxes
+ if (GetWindow(hwnd, GW_OWNER)) return NULL; // Dialog boxes, etc
+ if (exstyle & WS_EX_TOOLWINDOW) return NULL; // Floating toolbars
+ }
+