diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 7f0df16c..11315f0f 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -419,6 +419,9 @@ extern "C" { /*! @ingroup input */ #define GLFW_MOD_ALT 0x0004 +/*! @ingroup input + */ +#define GLFW_MOD_SUPER 0x0008 /*! @} */ diff --git a/src/cocoa_window.m b/src/cocoa_window.m index c7c4c115..dccafd79 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -213,6 +213,8 @@ static int convertKeyMods(NSUInteger flags) mods |= GLFW_MOD_CONTROL; if (flags & NSAlternateKeyMask) mods |= GLFW_MOD_ALT; + if (flags & NSCommandKeyMask) + mods |= GLFW_MOD_SUPER; return mods; } diff --git a/src/win32_window.c b/src/win32_window.c index 3dffd964..a7c48960 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -116,6 +116,8 @@ static int getKeyMods(void) mods |= GLFW_MOD_CONTROL; if (GetKeyState(VK_MENU) & (1 << 31)) mods |= GLFW_MOD_ALT; + if ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & (1 << 31)) + mods |= GLFW_MOD_SUPER; return mods; } @@ -132,6 +134,8 @@ static int getAsyncKeyMods(void) mods |= GLFW_MOD_CONTROL; if (GetAsyncKeyState(VK_MENU) & (1 << 31)) mods |= GLFW_MOD_ALT; + if ((GetAsyncKeyState(VK_LWIN) | GetAsyncKeyState(VK_RWIN)) & (1 << 31)) + mods |= GLFW_MOD_SUPER; return mods; } diff --git a/src/x11_window.c b/src/x11_window.c index 56c66777..1ca6ecaa 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -70,6 +70,8 @@ int translateState(int state) mods |= GLFW_MOD_CONTROL; if (state & Mod1Mask) mods |= GLFW_MOD_ALT; + if (state & Mod4Mask) + mods |= GLFW_MOD_SUPER; return mods; } diff --git a/tests/events.c b/tests/events.c index 2e61a681..d01663fb 100644 --- a/tests/events.c +++ b/tests/events.c @@ -219,6 +219,8 @@ static const char* get_mods_name(int mods) strcat(name, " control"); if (mods & GLFW_MOD_ALT) strcat(name, " alt"); + if (mods & GLFW_MOD_SUPER) + strcat(name, " super"); return name; }