本文整理汇总了C++中KeyboardEvent::setDeviceInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyboardEvent::setDeviceInfo方法的具体用法?C++ KeyboardEvent::setDeviceInfo怎么用?C++ KeyboardEvent::setDeviceInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyboardEvent
的用法示例。
在下文中一共展示了KeyboardEvent::setDeviceInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleKeyboard
// Dispatch a keyboard event to any registered handlers
void EventDispatcher::handleKeyboard(KeyboardEvent& evt)
{
HANDLE dev = evt.getDeviceHandle();
{
// Set the device info if it's available
ScopedCriticalSection kMutex(&kdLock);
if(keyboardDevices.count(dev) > 0)
{
evt.setDeviceInfo(keyboardDevices[dev]);
}
else
{
// It's an unknown device, let's see what we can find out about it.
ScopedNonCriticalSection unlock(&kdLock);
KeyboardInfo *kbd = unknownKeyboardDevice(dev);
if(kbd)
{
evt.setDeviceInfo(kbd);
}
}
}
{
// Run the chain, let someone make a decision about this event
ScopedCriticalSection kecMutex(&kecLock);
if(kbdEventChains.count(dev) > 0 && kbdEventChains[dev]->chainSize() > 0)
{
// We've got a real handler, give it to them (and hard)
kbdEventChains[dev]->runKeyboardEventChain(evt);
}
else
{
// Ain't nobody here. Do something?
}
}
}