本文整理汇总了C++中listhookedpointing::Item::get_previousbuttons方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::get_previousbuttons方法的具体用法?C++ Item::get_previousbuttons怎么用?C++ Item::get_previousbuttons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类listhookedpointing::Item
的用法示例。
在下文中一共展示了Item::get_previousbuttons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push_RelativePointerEventCallback
// ----------------------------------------------------------------------
void EventInputQueue::push_RelativePointerEventCallback(OSObject* target,
int buttons_raw,
int dx,
int dy,
AbsoluteTime ts,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_RelativePointerEventCallback::log(true, Buttons(buttons_raw), dx, dy);
// ------------------------------------------------------------
Buttons buttons(buttons_raw);
Buttons justPressed;
Buttons justReleased;
IOHIPointing* device = OSDynamicCast(IOHIPointing, sender);
if (!device) return;
ListHookedPointing::Item* item = static_cast<ListHookedPointing::Item*>(ListHookedPointing::instance().get(device));
if (!item) return;
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
// ------------------------------------------------------------
justPressed = buttons.justPressed(item->get_previousbuttons());
justReleased = buttons.justReleased(item->get_previousbuttons());
item->set_previousbuttons(buttons);
// ------------------------------------------------------------
// divide an event into button and cursormove events.
for (int i = 0; i < ButtonStatus::MAXNUM; ++i) {
PointingButton btn(1 << i);
if (justPressed.isOn(btn)) {
Params_RelativePointerEventCallback params(buttons, 0, 0, btn, true);
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
}
if (justReleased.isOn(btn)) {
Params_RelativePointerEventCallback params(buttons, 0, 0, btn, false);
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
}
}
// If (dx == 0 && dy == 0), the event is either needless event or just pressing/releasing buttons event.
// About just pressing/releasing buttons event, we handled these in the above processes.
// So, we can drop (dx == 0 && dy == 0) events in here.
if (dx != 0 || dy != 0) {
Params_RelativePointerEventCallback params(buttons, dx, dy, PointingButton::NONE, false);
bool retainFlagStatusTemporaryCount = true;
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
}
setTimer();
}
示例2: lk_eventlock
// ----------------------------------------------------------------------
void
EventInputQueue::push_RelativePointerEventCallback(OSObject* target,
int buttons_raw,
int dx,
int dy,
AbsoluteTime ts,
OSObject* sender,
void* refcon)
{
IOLockWrapper::ScopedLock lk_eventlock(CommonData::getEventLock());
if (! lk_eventlock) return;
IOLockWrapper::ScopedLock lk(timer_.getlock());
if (! lk) return;
// ------------------------------------------------------------
Buttons buttons(buttons_raw);
Buttons justPressed;
Buttons justReleased;
DeviceVendor deviceVendor(0);
DeviceProduct deviceProduct(0);
{
IOLockWrapper::ScopedLock lk_device(ListHookedKeyboard::instance().getListLock());
if (! lk_device) return;
IOHIPointing* device = OSDynamicCast(IOHIPointing, sender);
if (! device) return;
ListHookedPointing::Item* item = static_cast<ListHookedPointing::Item*>(ListHookedPointing::instance().get_nolock(device));
if (! item) return;
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
deviceVendor = item->getVendor();
deviceProduct = item->getProduct();
// ------------------------------------------------------------
justPressed = buttons.justPressed(item->get_previousbuttons());
justReleased = buttons.justReleased(item->get_previousbuttons());
item->set_previousbuttons(buttons);
}
// ------------------------------------------------------------
// divide an event into button and cursormove events.
for (int i = 0; i < ButtonStatus::MAXNUM; ++i) {
PointingButton btn(1 << i);
if (justPressed.isOn(btn)) {
Params_RelativePointerEventCallback::auto_ptr ptr(Params_RelativePointerEventCallback::alloc(buttons, 0, 0, btn, true));
if (! ptr) return;
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(*ptr, retainFlagStatusTemporaryCount, deviceVendor, deviceProduct);
}
if (justReleased.isOn(btn)) {
Params_RelativePointerEventCallback::auto_ptr ptr(Params_RelativePointerEventCallback::alloc(buttons, 0, 0, btn, false));
if (! ptr) return;
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(*ptr, retainFlagStatusTemporaryCount, deviceVendor, deviceProduct);
}
}
Params_RelativePointerEventCallback::auto_ptr ptr(Params_RelativePointerEventCallback::alloc(buttons, dx, dy, PointingButton::NONE, false));
if (! ptr) return;
bool retainFlagStatusTemporaryCount = true;
enqueue_(*ptr, retainFlagStatusTemporaryCount, deviceVendor, deviceProduct);
setTimer();
}