コード例 #1
0
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();
}
コード例 #2
0
  bool
  HookedKeyboard::terminate(void)
  {
    bool result = restoreEventAction();

    device_ = NULL;
    orig_keyboardEventAction_ = NULL;
    orig_keyboardEventTarget_ = NULL;

    return result;
  }
コード例 #3
0
  bool
  HookedKeyboard::refresh(void)
  {
    if (! config.initialized) {
      return restoreEventAction();
    }
    if (! isAppleDriver_ && config.general_dont_remap_thirdvendor_keyboard) {
      return restoreEventAction();
    }
    if (isInternalKeyboard_) {
      if (config.general_dont_remap_internal) {
        return restoreEventAction();
      }
    } else {
      if (config.general_dont_remap_external) {
        return restoreEventAction();
      }
    }

    return replaceEventAction();
  }
コード例 #4
0
  // ----------------------------------------------------------------------
  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();
  }
コード例 #5
0
  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();
  }
コード例 #6
0
  bool
  ListHookedPointing::Item::refresh_callback(void)
  {
    if (! device_) goto restore;

    // ------------------------------------------------------------
    if (! Config::initialized) {
      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) &&
        isEqualVendor(DeviceVendor::APPLE_COMPUTER)) {
      goto restore;
    }

    // Logitech Cordless Presenter
    if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_dont_remap_logitech_cordless_presenter) &&
        isEqualVendorProduct(DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_CORDLESS_PRESENTER)) {
      goto restore;
    }
#if 0
    // Apple Magic Mouse
    if (isEqualVendorProduct(DeviceVendor::APPLE_COMPUTER, DeviceProduct::MAGIC_MOUSE)) {
      goto restore;
    }
#endif

    return replaceEventAction();

  restore:
    return restoreEventAction();
  }
コード例 #7
0
 ListHookedConsumer::Item::~Item(void)
 {
   IOLOG_DEBUG("ListHookedConsumer::Item::~Item()\n");
   restoreEventAction();
 }
コード例 #8
0
// ======================================================================
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();
}
コード例 #9
0
ListHookedKeyboard::Item::~Item(void) {
  IOLOG_DEBUG("ListHookedKeyboard::Item::~Item()\n");
  restoreEventAction();
}
コード例 #10
0
 ListHookedConsumer::Item::~Item(void)
 {
   IOLOG_DEBUG("ListHookedConsumer::Item::~Item()\n");
   restoreEventAction();
   IOLockWrapper::free(replacerestore_lock_);
 }
コード例 #11
0
 ListHookedPointing::Item::~Item(void)
 {
   IOLOG_DEBUG("ListHookedPointing::Item::~Item()\n");
   restoreEventAction();
 }
コード例 #12
0
  // ======================================================================
  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();
  }