From 5982d745c315f2b73d43f82ca018d183198c15af Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 30 Apr 2012 19:27:03 +0000 Subject: Implement modifiers for Windows. --- pugl/pugl_win.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp index 2cb135c..a9641ad 100644 --- a/pugl/pugl_win.cpp +++ b/pugl/pugl_win.cpp @@ -196,6 +196,17 @@ processMouseEvent(PuglView* view, int button, bool press, LPARAM lParam) } } +static void +setModifiers(PuglView* view) +{ + view->mods = 0; + view->mods |= GetKeyState(VK_SHIFT) ? PUGL_MOD_SHIFT : 0; + view->mods |= GetKeyState(VK_CONTROL) ? PUGL_MOD_CTRL : 0; + view->mods |= GetKeyState(VK_MENU) ? PUGL_MOD_ALT : 0; + view->mods |= GetKeyState(VK_LWIN) ? PUGL_MOD_SUPER : 0; + view->mods |= GetKeyState(VK_RWIN) ? PUGL_MOD_SUPER : 0; +} + PuglStatus puglProcessEvents(PuglView* view) { @@ -205,6 +216,7 @@ puglProcessEvents(PuglView* view) bool down = true; PuglKey key; while (PeekMessage(&msg, /*view->impl->hwnd*/0, 0, 0, PM_REMOVE)) { + setModifiers(view); switch (msg.message) { case WM_CREATE: case WM_SHOWWINDOW: -- cgit v1.2.1