Example #1
0
 bool isOn(Flags flags) const {
   if (flags.isOn(ModifierFlag::NONE)) {
     return (value_ | ModifierFlag::NONE.get()) == flags.get();
   } else {
     return (value_ & flags.get()) == flags.get();
   }
 }
Example #2
0
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();
  }
Example #5
0
		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()
						)
					);
		}
Example #6
0
		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
						)
					);
		}
Example #7
0
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()); }
Example #9
0
 // ----------------------------------------
 static void log(bool isCaught, Flags flags) {
   IOLOG_DEBUG("UpdateEventFlagsCallback [%7s]: flags 0x%08x\n",
               isCaught ? "caught" : "sending",
               flags.get());
 }
Example #10
0
 // ----------------------------------------
 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);
 }
Example #11
0
 // ----------------------------------------
 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);
 }
Example #12
0
 Flags operator&(Flags other) const { return value_ & other.get(); }
Example #13
0
 Flags operator|(Flags other) const { return value_ | other.get(); }
Example #14
0
 bool operator==(Flags other) const { return value_ == other.get(); }
 void add(KeyToKeyType::Value type, Flags newval)   { add(type, BRIDGE_DATATYPE_FLAGS,   newval.get()); }