1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Added super modifier bit.

Edited during merge.
This commit is contained in:
Noel Cower 2013-05-23 13:22:27 +02:00 committed by Camilla Berglund
parent 3bcffba24a
commit eff85f9500
5 changed files with 13 additions and 0 deletions

View File

@ -419,6 +419,9 @@ extern "C" {
/*! @ingroup input /*! @ingroup input
*/ */
#define GLFW_MOD_ALT 0x0004 #define GLFW_MOD_ALT 0x0004
/*! @ingroup input
*/
#define GLFW_MOD_SUPER 0x0008
/*! @} */ /*! @} */

View File

@ -213,6 +213,8 @@ static int convertKeyMods(NSUInteger flags)
mods |= GLFW_MOD_CONTROL; mods |= GLFW_MOD_CONTROL;
if (flags & NSAlternateKeyMask) if (flags & NSAlternateKeyMask)
mods |= GLFW_MOD_ALT; mods |= GLFW_MOD_ALT;
if (flags & NSCommandKeyMask)
mods |= GLFW_MOD_SUPER;
return mods; return mods;
} }

View File

@ -116,6 +116,8 @@ static int getKeyMods(void)
mods |= GLFW_MOD_CONTROL; mods |= GLFW_MOD_CONTROL;
if (GetKeyState(VK_MENU) & (1 << 31)) if (GetKeyState(VK_MENU) & (1 << 31))
mods |= GLFW_MOD_ALT; mods |= GLFW_MOD_ALT;
if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & (1 << 31))
mods |= GLFW_MOD_SUPER;
return mods; return mods;
} }
@ -132,6 +134,8 @@ static int getAsyncKeyMods(void)
mods |= GLFW_MOD_CONTROL; mods |= GLFW_MOD_CONTROL;
if (GetAsyncKeyState(VK_MENU) & (1 << 31)) if (GetAsyncKeyState(VK_MENU) & (1 << 31))
mods |= GLFW_MOD_ALT; mods |= GLFW_MOD_ALT;
if ((GetAsyncKeyState(VK_LWIN) | GetAsyncKeyState(VK_RWIN)) & (1 << 31))
mods |= GLFW_MOD_SUPER;
return mods; return mods;
} }

View File

@ -70,6 +70,8 @@ int translateState(int state)
mods |= GLFW_MOD_CONTROL; mods |= GLFW_MOD_CONTROL;
if (state & Mod1Mask) if (state & Mod1Mask)
mods |= GLFW_MOD_ALT; mods |= GLFW_MOD_ALT;
if (state & Mod4Mask)
mods |= GLFW_MOD_SUPER;
return mods; return mods;
} }

View File

@ -219,6 +219,8 @@ static const char* get_mods_name(int mods)
strcat(name, " control"); strcat(name, " control");
if (mods & GLFW_MOD_ALT) if (mods & GLFW_MOD_ALT)
strcat(name, " alt"); strcat(name, " alt");
if (mods & GLFW_MOD_SUPER)
strcat(name, " super");
return name; return name;
} }