diff --git a/bindings/c/include/SFML/Window/Event.h b/bindings/c/include/SFML/Window/Event.h index c1484697..9782e2b7 100644 --- a/bindings/c/include/SFML/Window/Event.h +++ b/bindings/c/include/SFML/Window/Event.h @@ -203,6 +203,7 @@ struct sfKeyEvent sfBool Alt; sfBool Control; sfBool Shift; + sfBool System; }; //////////////////////////////////////////////////////////// diff --git a/bindings/c/src/SFML/ConvertEvent.h b/bindings/c/src/SFML/ConvertEvent.h index 06a222d8..18b5e6d9 100644 --- a/bindings/c/src/SFML/ConvertEvent.h +++ b/bindings/c/src/SFML/ConvertEvent.h @@ -58,6 +58,7 @@ inline void ConvertEvent(const sf::Event& SFMLEvent, sfEvent* event) event->Key.Alt = SFMLEvent.Key.Alt ? sfTrue : sfFalse; event->Key.Control = SFMLEvent.Key.Control ? sfTrue : sfFalse; event->Key.Shift = SFMLEvent.Key.Shift ? sfTrue : sfFalse; + event->Key.System = SFMLEvent.Key.System ? sfTrue : sfFalse; break; case sfEvtMouseWheelMoved : diff --git a/bindings/dotnet/extlibs/x64/csfml-audio-2.dll b/bindings/dotnet/extlibs/x64/csfml-audio-2.dll index 5217ada8..a07fdb93 100644 Binary files a/bindings/dotnet/extlibs/x64/csfml-audio-2.dll and b/bindings/dotnet/extlibs/x64/csfml-audio-2.dll differ diff --git a/bindings/dotnet/extlibs/x64/csfml-graphics-2.dll b/bindings/dotnet/extlibs/x64/csfml-graphics-2.dll index d3b31eab..d1c36621 100644 Binary files a/bindings/dotnet/extlibs/x64/csfml-graphics-2.dll and b/bindings/dotnet/extlibs/x64/csfml-graphics-2.dll differ diff --git a/bindings/dotnet/extlibs/x64/csfml-window-2.dll b/bindings/dotnet/extlibs/x64/csfml-window-2.dll index 6e8e5d95..253d1763 100644 Binary files a/bindings/dotnet/extlibs/x64/csfml-window-2.dll and b/bindings/dotnet/extlibs/x64/csfml-window-2.dll differ diff --git a/bindings/dotnet/extlibs/x86/csfml-audio-2.dll b/bindings/dotnet/extlibs/x86/csfml-audio-2.dll index f731f385..458ca4ae 100644 Binary files a/bindings/dotnet/extlibs/x86/csfml-audio-2.dll and b/bindings/dotnet/extlibs/x86/csfml-audio-2.dll differ diff --git a/bindings/dotnet/extlibs/x86/csfml-graphics-2.dll b/bindings/dotnet/extlibs/x86/csfml-graphics-2.dll index 28293f8f..22804425 100644 Binary files a/bindings/dotnet/extlibs/x86/csfml-graphics-2.dll and b/bindings/dotnet/extlibs/x86/csfml-graphics-2.dll differ diff --git a/bindings/dotnet/extlibs/x86/csfml-window-2.dll b/bindings/dotnet/extlibs/x86/csfml-window-2.dll index 48865ceb..e4f4e44c 100644 Binary files a/bindings/dotnet/extlibs/x86/csfml-window-2.dll and b/bindings/dotnet/extlibs/x86/csfml-window-2.dll differ diff --git a/bindings/dotnet/src/Window/Event.cs b/bindings/dotnet/src/Window/Event.cs index 06ec8356..9923f09b 100644 --- a/bindings/dotnet/src/Window/Event.cs +++ b/bindings/dotnet/src/Window/Event.cs @@ -242,6 +242,9 @@ namespace SFML /// Is the Shift modifier pressed? public int Shift; + + /// Is the System modifier pressed? + public int System; } //////////////////////////////////////////////////////////// diff --git a/bindings/dotnet/src/Window/EventArgs.cs b/bindings/dotnet/src/Window/EventArgs.cs index 25b41baf..37c26d76 100644 --- a/bindings/dotnet/src/Window/EventArgs.cs +++ b/bindings/dotnet/src/Window/EventArgs.cs @@ -23,6 +23,7 @@ namespace SFML Alt = e.Alt != 0; Control = e.Control != 0; Shift = e.Shift != 0; + System = e.System != 0; } //////////////////////////////////////////////////////////// @@ -37,7 +38,8 @@ namespace SFML " Code(" + Code + ")" + " Alt(" + Alt + ")" + " Control(" + Control + ")" + - " Shift(" + Shift + ")"; + " Shift(" + Shift + ")" + + " System(" + System + ")"; } /// Code of the key (see KeyCode enum) @@ -51,6 +53,9 @@ namespace SFML /// Is the Shift modifier pressed? public bool Shift; + + /// Is the System modifier pressed? + public bool System; } //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp index 078da4d8..1d900b52 100644 --- a/include/SFML/Window/Event.hpp +++ b/include/SFML/Window/Event.hpp @@ -215,6 +215,7 @@ public : bool Alt; ///< Is the Alt key pressed? bool Control; ///< Is the Control key pressed? bool Shift; ///< Is the Shift key pressed? + bool System; ///< Is the System key pressed? }; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp index 490e6fa9..3a64fbc1 100644 --- a/src/SFML/Window/Linux/WindowImplX11.cpp +++ b/src/SFML/Window/Linux/WindowImplX11.cpp @@ -686,12 +686,14 @@ bool WindowImplX11::ProcessEvent(XEvent windowEvent) XLookupString(&windowEvent.xkey, buffer, sizeof(buffer), &symbol, &keyboard); // Fill the event parameters + // TODO: if modifiers are wrong, use XGetModifierMapping to retrieve the actual modifiers mapping Event event; event.Type = Event::KeyPressed; event.Key.Code = KeysymToSF(symbol); event.Key.Alt = windowEvent.xkey.state & Mod1Mask; event.Key.Control = windowEvent.xkey.state & ControlMask; event.Key.Shift = windowEvent.xkey.state & ShiftMask; + event.Key.System = windowEvent.xkey.state & Mod4Mask; PushEvent(event); // Generate a TextEntered event @@ -749,6 +751,7 @@ bool WindowImplX11::ProcessEvent(XEvent windowEvent) event.Key.Alt = windowEvent.xkey.state & Mod1Mask; event.Key.Control = windowEvent.xkey.state & ControlMask; event.Key.Shift = windowEvent.xkey.state & ShiftMask; + event.Key.System = windowEvent.xkey.state & Mod4Mask; PushEvent(event); break; diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index 558da6d8..0788c5b1 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -498,6 +498,7 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam) event.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0; event.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; event.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; + event.Key.System = HIWORD(GetAsyncKeyState(VK_LWIN)) || HIWORD(GetAsyncKeyState(VK_RWIN)); event.Key.Code = VirtualKeyCodeToSF(wParam, lParam); PushEvent(event); } @@ -514,6 +515,7 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam) event.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; event.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; event.Key.Code = VirtualKeyCodeToSF(wParam, lParam); + event.Key.System = HIWORD(GetAsyncKeyState(VK_LWIN)) || HIWORD(GetAsyncKeyState(VK_RWIN)); PushEvent(event); break; }