mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Added the sf::Event::KeyEvent::System member (implements feature #8)
This commit is contained in:
parent
eac841ec71
commit
ede01df778
@ -203,6 +203,7 @@ struct sfKeyEvent
|
||||
sfBool Alt;
|
||||
sfBool Control;
|
||||
sfBool Shift;
|
||||
sfBool System;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -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 :
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -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?
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user