diff --git a/bindings/c/include/SFML/Window/Event.h b/bindings/c/include/SFML/Window/Event.h index c14846971..9782e2b7f 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 06a222d88..18b5e6d95 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 5217ada82..a07fdb931 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 d3b31eab7..d1c366213 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 6e8e5d957..253d1763c 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 f731f3855..458ca4ae9 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 28293f8ff..228044258 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 48865ceb6..e4f4e44c7 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 06ec8356f..9923f09b6 100644 --- a/bindings/dotnet/src/Window/Event.cs +++ b/bindings/dotnet/src/Window/Event.cs @@ -242,6 +242,9 @@ namespace SFML /// <summary>Is the Shift modifier pressed?</summary> public int Shift; + + /// <summary>Is the System modifier pressed?</summary> + public int System; } //////////////////////////////////////////////////////////// diff --git a/bindings/dotnet/src/Window/EventArgs.cs b/bindings/dotnet/src/Window/EventArgs.cs index 25b41baf9..37c26d76a 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 + ")"; } /// <summary>Code of the key (see KeyCode enum)</summary> @@ -51,6 +53,9 @@ namespace SFML /// <summary>Is the Shift modifier pressed?</summary> public bool Shift; + + /// <summary>Is the System modifier pressed?</summary> + public bool System; } //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp index 078da4d87..1d900b523 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 490e6fa98..3a64fbc10 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 558da6d8a..0788c5b1c 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; }