aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-30 19:27:03 +0000
committerDavid Robillard <d@drobilla.net>2012-04-30 19:27:03 +0000
commit5982d745c315f2b73d43f82ca018d183198c15af (patch)
tree61e7a8f1e7dfb5fa2796ee7286641742fc06f96f
parentfcd41b09001c2438595a94132c7ae6664c4d1bc3 (diff)
Implement modifiers for Windows.
-rw-r--r--pugl/pugl_win.cpp12
1 files changed, 12 insertions, 0 deletions
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: