bool ListHookedPointing::Item::refresh(void) { if (!device_) goto restore; // ------------------------------------------------------------ if (!Config::get_initialized()) { goto restore; } if (!Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_notsave_automatically_enable_pointing_device)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_any_pointing)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_thirdvendor_pointing) && deviceType_ != DeviceType::APPLE_INTERNAL && deviceType_ != DeviceType::APPLE_EXTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_apple_pointing) && getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_non_apple_pointing) && !getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } // ------------------------------------------------------------ return replaceEventAction(); restore: return restoreEventAction(); }
const char * CNClient::getClientParameters(void) { if (s_sClientParameters.empty()) { s_sClientParameters = ""; // client-version s_sClientParameters.append("client-version=").append(getVersion()); // screen CCSize size = getScreenSize(); CCFloat scale = getScreenScale(); char szScreen[32]; memset(szScreen, 0, 32); snprintf(szScreen, 32, "%.0fx%.0f@%.1f", size.width, size.height, scale); s_sClientParameters.append("&screen=").append(szScreen); // os std::string sOS = std::string(getSystemName()).append("/").append(getSystemVersion()); s_sClientParameters.append("&os=").append(sOS); // device std::string sDevice = std::string(getDeviceModel()).append("/").append(getHardware()); s_sClientParameters.append("&device=").append(sDevice); // imei s_sClientParameters.append("&imei=").append(getDeviceIdentifier()); } return s_sClientParameters.c_str(); }
void Client::updateClientParameters(void) { std::string string = ""; // client-version string.append("client-version=").append(getVersion()); // screen char screen[32]; memset(screen, 0, 32); snprintf(screen, 32, "%dx%d", getScreenWidth(), getScreenHeight()); string.append("&screen=").append(screen); // os std::string os = std::string(getSystemName()).append("/").append(getSystemVersion()); UrlUtils::escape(os); string.append("&os=").append(os); // device std::string device = std::string(getDeviceModel()).append("/").append(getHardware()); UrlUtils::escape(device); string.append("&device=").append(device); // imei string.append("&imei=").append(getDeviceIdentifier()); m_sClientParameters = string; }
bool ListHookedPointing::Item::refresh(void) { if (! device_) goto restore; // ------------------------------------------------------------ if (! Config::get_initialized()) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_any_pointing)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_thirdvendor_pointing) && deviceType_ != DeviceType::APPLE_INTERNAL && deviceType_ != DeviceType::APPLE_EXTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_apple_pointing) && getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_non_apple_pointing) && ! getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } // Logitech Cordless Presenter if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_logitech_cordless_presenter) && getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_CORDLESS_PRESENTER)) { goto restore; } return replaceEventAction(); restore: return restoreEventAction(); }
// ---------------------------------------------------------------------- bool ListHookedConsumer::Item::refresh(void) { if (! device_) goto restore; { const char* name = device_->getName(); if (! name) goto restore; if (! ListHookedDevice::Item::isConsumer(name)) goto restore; } // ------------------------------------------------------------ if (! Config::get_initialized()) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_apple_keyboard) && getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_non_apple_keyboard) && ! getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } // Logitech USB Headset if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_USB_HEADSET)) { goto restore; } // Logitech Cordless Presenter if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_logitech_cordless_presenter) && getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_CORDLESS_PRESENTER)) { goto restore; } #if 0 // Apple Internal Keyboard if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::APPLE_COMPUTER, DeviceProduct::APPLE_INTERNAL_KEYBOARD_TRACKPAD_0x021a)) { goto restore; } #endif #if 0 // Apple External Keyboard if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::APPLE_COMPUTER, DeviceProduct::APPLE_ALUMINUM_KEYBOARD_JIS)) { goto restore; } #endif return replaceEventAction(); restore: return restoreEventAction(); }
// ====================================================================== bool ListHookedKeyboard::Item::refresh(void) { if (!device_) goto restore; { const char* name = device_->getName(); if (!name) goto restore; if (ListHookedDevice::Item::isConsumer(name)) goto restore; } // ------------------------------------------------------------ if (!Config::get_initialized()) { goto restore; } if (!Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_notsave_automatically_enable_keyboard_device)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_thirdvendor_keyboard) && deviceType_ != DeviceType::APPLE_INTERNAL && deviceType_ != DeviceType::APPLE_EXTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_internal) && deviceType_ == DeviceType::APPLE_INTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_external) && deviceType_ != DeviceType::APPLE_INTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_apple_keyboard) && getDeviceIdentifier().isApple()) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_non_apple_keyboard) && !getDeviceIdentifier().isApple()) { goto restore; } // Logitech USB Headset if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_USB_HEADSET)) { goto restore; } // Kensington Virtual Device (0x0, 0x0) if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::PSEUDO, DeviceProduct::PSEUDO)) { if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_allow_devices_vendor_id_product_id_are_zero)) { // do nothing } else { // Note: USB Overdrive also use 0x0,0x0. // We allow to use USB Overdrive. if (deviceType_ != DeviceType::USB_OVERDRIVE) { goto restore; } } } // ------------------------------------------------------------ return replaceEventAction(); restore: return restoreEventAction(); }
// ====================================================================== bool ListHookedKeyboard::Item::refresh(void) { if (! device_) goto restore; { const char* name = device_->getName(); if (! name) goto restore; if (ListHookedDevice::Item::isConsumer(name)) goto restore; } // ------------------------------------------------------------ if (! Config::get_initialized()) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_thirdvendor_keyboard) && deviceType_ != DeviceType::APPLE_INTERNAL && deviceType_ != DeviceType::APPLE_EXTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_internal) && deviceType_ == DeviceType::APPLE_INTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_external) && deviceType_ != DeviceType::APPLE_INTERNAL) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_apple_keyboard) && getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_non_apple_keyboard) && ! getDeviceIdentifier().isEqualVendor(DeviceVendor::APPLE_COMPUTER)) { goto restore; } // Logitech USB Headset if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_USB_HEADSET)) { goto restore; } // Logitech Cordless Presenter if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_logitech_cordless_presenter) && getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_CORDLESS_PRESENTER)) { goto restore; } // Kensington Virtual Device (0x0, 0x0) if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::PSEUDO, DeviceProduct::PSEUDO)) { // Note: USB Overdrive also use 0x0,0x0. // We allow to use USB Overdrive. if (deviceType_ != DeviceType::USB_OVERDRIVE) { goto restore; } } #if 0 // Apple Internal Keyboard if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::APPLE_COMPUTER, DeviceProduct::APPLE_INTERNAL_KEYBOARD_TRACKPAD_0x021a)) { goto restore; } // Apple External Keyboard if (getDeviceIdentifier().isEqualVendorProduct(DeviceVendor::APPLE_COMPUTER, DeviceProduct::APPLE_ALUMINUM_KEYBOARD_JIS)) { goto restore; } #endif // ------------------------------------------------------------ return replaceEventAction(); restore: return restoreEventAction(); }