mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Allow both shift keys to be used for all hotkeys
Handle both shift keys in some cases where only the left shift key was previously supported. The `CChat::m_ReverseTAB` variable is removed because it's unnecessary.
This commit is contained in:
parent
04be9d6e72
commit
ab9b6c2b80
|
@ -81,7 +81,6 @@ void CChat::Reset()
|
|||
m_PrevScoreBoardShowed = false;
|
||||
m_PrevShowChat = false;
|
||||
|
||||
m_ReverseTAB = false;
|
||||
m_Show = false;
|
||||
m_InputUpdate = false;
|
||||
m_ChatStringOffset = 0;
|
||||
|
@ -307,6 +306,8 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
}
|
||||
if(Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key == KEY_TAB)
|
||||
{
|
||||
const bool ShiftPressed = Input()->ShiftIsPressed();
|
||||
|
||||
// fill the completion buffer
|
||||
if(!m_CompletionUsed)
|
||||
{
|
||||
|
@ -353,9 +354,9 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
|
||||
const size_t NumCommands = m_vCommands.size();
|
||||
|
||||
if(m_ReverseTAB && m_CompletionUsed)
|
||||
if(ShiftPressed && m_CompletionUsed)
|
||||
m_CompletionChosen--;
|
||||
else if(!m_ReverseTAB)
|
||||
else if(!ShiftPressed)
|
||||
m_CompletionChosen++;
|
||||
m_CompletionChosen = (m_CompletionChosen + 2 * NumCommands) % (2 * NumCommands);
|
||||
|
||||
|
@ -367,7 +368,7 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
int SearchType;
|
||||
int Index;
|
||||
|
||||
if(m_ReverseTAB)
|
||||
if(ShiftPressed)
|
||||
{
|
||||
SearchType = ((m_CompletionChosen - i + 2 * NumCommands) % (2 * NumCommands)) / NumCommands;
|
||||
Index = (m_CompletionChosen - i + NumCommands) % NumCommands;
|
||||
|
@ -425,11 +426,11 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
CGameClient::CClientData *pCompletionClientData;
|
||||
for(int i = 0; i < m_PlayerCompletionListLength; ++i)
|
||||
{
|
||||
if(m_ReverseTAB && m_CompletionUsed)
|
||||
if(ShiftPressed && m_CompletionUsed)
|
||||
{
|
||||
m_CompletionChosen--;
|
||||
}
|
||||
else if(!m_ReverseTAB)
|
||||
else if(!ShiftPressed)
|
||||
{
|
||||
m_CompletionChosen++;
|
||||
}
|
||||
|
@ -484,27 +485,17 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
else
|
||||
{
|
||||
// reset name completion process
|
||||
if(Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key != KEY_TAB)
|
||||
{
|
||||
if(Event.m_Key != KEY_LSHIFT)
|
||||
if(Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key != KEY_TAB && Event.m_Key != KEY_LSHIFT && Event.m_Key != KEY_RSHIFT)
|
||||
{
|
||||
m_CompletionChosen = -1;
|
||||
m_CompletionUsed = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_OldChatStringLength = m_Input.GetLength();
|
||||
m_Input.ProcessInput(Event);
|
||||
m_InputUpdate = true;
|
||||
}
|
||||
if(Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key == KEY_LSHIFT)
|
||||
{
|
||||
m_ReverseTAB = true;
|
||||
}
|
||||
else if(Event.m_Flags & IInput::FLAG_RELEASE && Event.m_Key == KEY_LSHIFT)
|
||||
{
|
||||
m_ReverseTAB = false;
|
||||
}
|
||||
|
||||
if(Event.m_Flags & IInput::FLAG_PRESS && Event.m_Key == KEY_UP)
|
||||
{
|
||||
if(m_pHistoryEntry)
|
||||
|
|
|
@ -110,7 +110,6 @@ class CChat : public CComponent
|
|||
};
|
||||
|
||||
std::vector<CCommand> m_vCommands;
|
||||
bool m_ReverseTAB;
|
||||
|
||||
struct CHistoryEntry
|
||||
{
|
||||
|
|
|
@ -2553,7 +2553,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
|
||||
if(Input()->ModifierIsPressed() || UI()->MouseButton(2))
|
||||
{
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT))
|
||||
if(Input()->ShiftIsPressed())
|
||||
s_Operation = OP_PAN_EDITOR;
|
||||
else
|
||||
s_Operation = OP_PAN_WORLD;
|
||||
|
@ -2646,7 +2646,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
{
|
||||
if(!UI()->MouseButton(0))
|
||||
{
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT))
|
||||
if(Input()->ShiftIsPressed())
|
||||
{
|
||||
CLayerQuads *pQuadLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(pQuadLayer)
|
||||
|
|
Loading…
Reference in a new issue