diff options
author | Dmitri Trembovetski <[email protected]> | 2009-06-16 22:50:13 +0000 |
---|---|---|
committer | Dmitri Trembovetski <[email protected]> | 2009-06-16 22:50:13 +0000 |
commit | 17d7da9dc0ec72a987dfa603fb83fb1951e846b4 (patch) | |
tree | 5b26de872d2cd6c30b6b2c3a39ee7c3d040cc7b1 /src/newt/native | |
parent | cd5ec0b088706ccc30159c2d6a5ead8e643cfd57 (diff) |
Newt: fix to avoid crash on windows when compiled with vc7 configuration (caused by the runtime checking enabled with /RTCcsu)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1967 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/newt/native')
-rwxr-xr-x | src/newt/native/WindowsWindow.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index a4a5914bc..b86159bb1 100755 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -461,22 +461,24 @@ static jchar* GetNullTerminatedStringChars(JNIEnv* env, jstring str) static jint GetModifiers() { jint modifiers = 0; - if (HIBYTE(GetKeyState(VK_CONTROL)) != 0) { + // have to do &0xFF to avoid runtime assert crash caused by compiling with + // /RTCcsu + if (HIBYTE((GetKeyState(VK_CONTROL) & 0xFF)) != 0) { modifiers |= EVENT_CTRL_MASK; } - if (HIBYTE(GetKeyState(VK_SHIFT)) != 0) { + if (HIBYTE((GetKeyState(VK_SHIFT) & 0xFF)) != 0) { modifiers |= EVENT_SHIFT_MASK; } - if (HIBYTE(GetKeyState(VK_MENU)) != 0) { + if (HIBYTE((GetKeyState(VK_MENU) & 0xFF)) != 0) { modifiers |= EVENT_ALT_MASK; } - if (HIBYTE(GetKeyState(VK_LBUTTON)) != 0) { + if (HIBYTE((GetKeyState(VK_LBUTTON) & 0xFF)) != 0) { modifiers |= EVENT_BUTTON1_MASK; } - if (HIBYTE(GetKeyState(VK_MBUTTON)) != 0) { + if (HIBYTE((GetKeyState(VK_MBUTTON) & 0xFF)) != 0) { modifiers |= EVENT_BUTTON2_MASK; } - if (HIBYTE(GetKeyState(VK_RBUTTON)) != 0) { + if (HIBYTE((GetKeyState(VK_RBUTTON) & 0xFF)) != 0) { modifiers |= EVENT_BUTTON3_MASK; } |