예제 #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();
   }
 }
예제 #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();
}
예제 #3
0
  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();
  }
예제 #4
0
  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();
  }
예제 #5
0
파일: Bitmap.hpp 프로젝트: azaika/wawl
		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()
						)
					);
		}
예제 #6
0
파일: Bitmap.hpp 프로젝트: azaika/wawl
		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
						)
					);
		}
예제 #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()); }
예제 #9
0
파일: Params.hpp 프로젝트: 11liju/Karabiner
 // ----------------------------------------
 static void log(bool isCaught, Flags flags) {
   IOLOG_DEBUG("UpdateEventFlagsCallback [%7s]: flags 0x%08x\n",
               isCaught ? "caught" : "sending",
               flags.get());
 }
예제 #10
0
파일: Params.hpp 프로젝트: 11liju/Karabiner
 // ----------------------------------------
 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);
 }
예제 #11
0
파일: Params.hpp 프로젝트: 11liju/Karabiner
 // ----------------------------------------
 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);
 }
예제 #12
0
 Flags operator&(Flags other) const { return value_ & other.get(); }
예제 #13
0
 Flags operator|(Flags other) const { return value_ | other.get(); }
예제 #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()); }