diff options
Diffstat (limited to 'source/game/StarInput.cpp')
-rw-r--r-- | source/game/StarInput.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/game/StarInput.cpp b/source/game/StarInput.cpp index 7577936..d47045d 100644 --- a/source/game/StarInput.cpp +++ b/source/game/StarInput.cpp @@ -678,8 +678,24 @@ void Input::setBinds(String const& categoryId, String const& bindId, Json const& entry.updated(); } -unsigned Input::getTag(String const& tag) { - return m_activeTags.maybe(tag).value(0); +unsigned Input::getTag(String const& tagName) const { + if (auto tag = m_activeTags.ptr(tagName)) + return *tag; + else + return 0; +} + +Input::ClipboardUnlock::ClipboardUnlock(Input& input) + : m_input(&input) { ++m_input->m_clipboardAllowed; }; + +Input::ClipboardUnlock::~ClipboardUnlock() { --m_input->m_clipboardAllowed; }; + +Input::ClipboardUnlock Input::unlockClipboard() { + return Input::ClipboardUnlock(*this); +} + +bool Input::clipboardAllowed() const { + return m_clipboardAllowed > 0 ? true : getTag("clipboard") > 0; } }
\ No newline at end of file |