本文整理汇总了C++中Keystrokes::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Keystrokes::push_back方法的具体用法?C++ Keystrokes::push_back怎么用?C++ Keystrokes::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keystrokes
的用法示例。
在下文中一共展示了Keystrokes::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
CKeyState::fakeToggle(KeyModifierMask modifier)
{
const KeyButtons& buttons = m_maskToKeys[getIndexForModifier(modifier)];
if (buttons.empty() || !isToggle(modifier)) {
return;
}
KeyButton button = buttons[0];
// get the sequence of keys to simulate key toggle
Keystrokes keys;
Keystroke keystroke;
keystroke.m_key = button;
keystroke.m_press = true;
keystroke.m_repeat = false;
keys.push_back(keystroke);
keystroke.m_press = false;
keys.push_back(keystroke);
// generate key events
fakeKeyEvents(keys, 1);
// note the toggle
m_keys[button] ^= kToggled;
m_mask ^= modifier;
}
示例2:
void
CKeyState::fakeAllKeysUp()
{
Keystrokes keys;
for (KeyButton i = 0; i < IKeyState::kNumButtons; ++i) {
if (m_syntheticKeys[i] > 0) {
keys.push_back(Keystroke(i, false, false, m_keyClientData[i]));
m_keys[i] = 0;
m_syntheticKeys[i] = 0;
}
}
fakeKeys(keys, 1);
}
示例3: sizeof
void
CKeyState::fakeAllKeysUp()
{
Keystrokes keys;
for (KeyButton i = 0; i < IKeyState::kNumButtons; ++i) {
if (m_syntheticKeys[i] > 0) {
keys.push_back(Keystroke(i, false, false, m_keyClientData[i]));
m_keys[i] = 0;
m_syntheticKeys[i] = 0;
}
}
fakeKeys(keys, 1);
memset(&m_serverKeys, 0, sizeof(m_serverKeys));
m_activeModifiers.clear();
m_mask = pollActiveModifiers();
}
示例4: if
bool
CKeyState::mapModifier(Keystrokes& keys, Keystrokes& undo,
KeyModifierMask mask, bool desireActive, bool force) const
{
// look up modifier
const KeyButtons& buttons = m_maskToKeys[getIndexForModifier(mask)];
if (buttons.empty()) {
return false;
}
// ignore if already in desired state
if (!force && isModifierActive(mask) == desireActive) {
return true;
}
// initialize keystroke
Keystroke keystroke;
keystroke.m_repeat = false;
// handle toggles
if (isToggle(mask)) {
keystroke.m_key = buttons[0];
keystroke.m_press = true;
keys.push_back(keystroke);
keystroke.m_press = false;
keys.push_back(keystroke);
keystroke.m_press = false;
undo.push_back(keystroke);
keystroke.m_press = true;
undo.push_back(keystroke);
}
else if (desireActive) {
// press
keystroke.m_key = buttons[0];
keystroke.m_press = true;
keys.push_back(keystroke);
keystroke.m_press = false;
undo.push_back(keystroke);
}
else {
// releasing a modifier is quite different from pressing one.
// when we release a modifier we have to release every keycode that
// is assigned to the modifier since the modifier is active if any
// one of them is down. when we press a modifier we just have to
// press one of those keycodes.
for (KeyButtons::const_iterator j = buttons.begin();
j != buttons.end(); ++j) {
if (isKeyDown(*j)) {
keystroke.m_key = *j;
keystroke.m_press = false;
keys.push_back(keystroke);
keystroke.m_press = true;
undo.push_back(keystroke);
}
}
}
return true;
}