MCPcopy Create free account
hub / github.com/deskflow/deskflow / isKeyPressed

Method isKeyPressed

src/unittests/platform/OSXKeyStateTests.cpp:116–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116bool OSXKeyStateTests::isKeyPressed(const OSXKeyState &keyState, KeyButton button)
117{
118 // HACK: allow os to realize key state changes.
119 Arch::sleep(.2);
120
121 IKeyState::KeyButtonSet pressed;
122 keyState.pollPressedKeys(pressed);
123
124 IKeyState::KeyButtonSet::const_iterator it;
125 for (it = pressed.begin(); it != pressed.end(); ++it) {
126 LOG_DEBUG("checking key %d", *it);
127 if (*it == button) {
128 return true;
129 }
130 }
131 return false;
132}
133
134QTEST_MAIN(OSXKeyStateTests)

Callers

nothing calls this directly

Calls 3

pollPressedKeysMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected