bool isOn(Flags flags) const { if (flags.isOn(ModifierFlag::NONE)) { return (value_ | ModifierFlag::NONE.get()) == flags.get(); } else { return (value_ & flags.get()) == flags.get(); } }
void KeyboardRepeat::set(EventType eventType, Flags flags, ConsumerKeyCode key, int delayUntilRepeat, int keyRepeat) { if (key == ConsumerKeyCode::VK_NONE) return; if (eventType == EventType::UP) { goto cancel; } else if (eventType == EventType::DOWN) { if (!key.isRepeatable()) { goto cancel; } cancel(); primitive_add(eventType, flags, key); primitive_start(delayUntilRepeat, keyRepeat); IOLOG_DEVEL("KeyboardRepeat::set consumer key:%d flags:0x%x\n", key.get(), flags.get()); } else { goto cancel; } return; cancel: cancel(); }
void KeyboardRepeat::set(EventType eventType, Flags flags, ConsumerKeyCode key) { if (! queue_) return; if (key == ConsumerKeyCode::VK_NONE) return; if (eventType == EventType::UP) { goto cancel; } else if (eventType == EventType::DOWN) { if (! key.isRepeatable()) { goto cancel; } cancel(); primitive_add(eventType, flags, key); primitive_start(Config::get_repeat_consumer_initial_wait(), Config::get_repeat_consumer_wait()); IOLOG_DEVEL("KeyboardRepeat::set consumer key:%d flags:0x%x\n", key.get(), flags.get()); } else { goto cancel; } return; cancel: cancel(); }
void KeyboardRepeat::set(EventType eventType, Flags flags, KeyCode key, KeyboardType keyboardType, int delayUntilRepeat, int keyRepeat) { if (! queue_) return; if (key == KeyCode::VK_NONE) return; if (eventType == EventType::MODIFY) { goto cancel; } else if (eventType == EventType::UP) { // The repetition of plural keys is controlled by manual operation. // So, we ignore it. if (queue_->size() != 1) return; // We stop key repeat only when the repeating key is up. KeyboardRepeat::Item* p = static_cast<KeyboardRepeat::Item*>(queue_->front()); if (p && (p->params).type == ParamsUnion::KEYBOARD) { Params_KeyboardEventCallBack* params = (p->params).params.params_KeyboardEventCallBack; if (params && key == params->key) { goto cancel; } } } else if (eventType == EventType::DOWN) { cancel(); primitive_add(eventType, flags, key, keyboardType, Item::TYPE_NORMAL); primitive_start(delayUntilRepeat, keyRepeat); IOLOG_DEVEL("KeyboardRepeat::set key:%d flags:0x%x\n", key.get(), flags.get()); } else { goto cancel; } return; cancel: cancel(); }
inline BitmapHandle loadBitmapFromResource( ModuleHandle module, const Tstring& instName, Flags<ImageLoadOption> loadOption, const Size& size = {} ) { return static_cast<BitmapHandle>( ::LoadImage( module, instName.c_str(), IMAGE_ICON, size.x, size.y, loadOption.get() ) ); }
inline BitmapHandle loadBitmap( ModuleHandle module, const Tstring& fileName, Flags<ImageLoadOption> loadOption, const Size& size ) { return static_cast<BitmapHandle>( ::LoadImage( module, fileName.c_str(), IMAGE_BITMAP, size.x, size.y, loadOption.get() | LR_LOADFROMFILE ) ); }
void KeyboardRepeat::set(EventType eventType, Flags flags, KeyCode key, KeyboardType keyboardType, int delayUntilRepeat, int keyRepeat) { if (key == KeyCode::VK_NONE) return; if (eventType == EventType::MODIFY) { goto cancel; } else if (eventType == EventType::UP) { // The repetition of multiple keys is controlled by manual operation. // So, we ignore it. if (queue_.size() != 1) return; // We stop key repeat only when the repeating key is up. KeyboardRepeat::Item* p = static_cast<KeyboardRepeat::Item*>(queue_.safe_front()); if (p) { auto params = (p->getParamsBase()).get_Params_KeyboardEventCallBack(); if (params && key == params->key) { goto cancel; } } } else if (eventType == EventType::DOWN) { cancel(); primitive_add(eventType, flags, key, keyboardType); primitive_start(delayUntilRepeat, keyRepeat); IOLOG_DEVEL("KeyboardRepeat::set key:%d flags:0x%x\n", key.get(), flags.get()); } else { goto cancel; } return; cancel: cancel(); }
void add(Flags newval) { add(BRIDGE_DATATYPE_FLAGS, newval.get()); }
// ---------------------------------------- static void log(bool isCaught, Flags flags) { IOLOG_DEBUG("UpdateEventFlagsCallback [%7s]: flags 0x%08x\n", isCaught ? "caught" : "sending", flags.get()); }
// ---------------------------------------- static void log(bool isCaught, EventType eventType, Flags flags, KeyCode key, KeyboardType keyboardType, bool repeat) { IOLOG_DEBUG("KeyboardEventCallback [%7s]: eventType %2d, flags 0x%08x, key 0x%04x, kbdType %3d, repeat = %d\n", isCaught ? "caught" : "sending", eventType.get(), flags.get(), key.get(), keyboardType.get(), repeat); }
// ---------------------------------------- static void log(bool isCaught, EventType eventType, Flags flags, ConsumerKeyCode key, unsigned int flavor, UInt64 guid, bool repeat) { IOLOG_DEBUG("KeyboardSpecialEventCallBack [%7s]: eventType %2d, flags 0x%08x, key 0x%04x, flavor %4d, guid %lld, repeat = %d\n", isCaught ? "caught" : "sending", eventType.get(), flags.get(), key.get(), flavor, guid, repeat); }
Flags operator&(Flags other) const { return value_ & other.get(); }
Flags operator|(Flags other) const { return value_ | other.get(); }
bool operator==(Flags other) const { return value_ == other.get(); }
void add(KeyToKeyType::Value type, Flags newval) { add(type, BRIDGE_DATATYPE_FLAGS, newval.get()); }