当前位置: 首页>>代码示例>>C++>>正文


C++ Keystrokes::push_back方法代码示例

本文整理汇总了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;
}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:26,代码来源:CKeyState.cpp

示例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);
}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:13,代码来源:CKeyState.cpp

示例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();
}
开发者ID:dbkr,项目名称:synergy-onnaf,代码行数:16,代码来源:CKeyState.cpp

示例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;
}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:61,代码来源:CKeyState.cpp


注:本文中的Keystrokes::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。