Exemple #1
0
static int extern_node_matches(struct name *expected, struct node *node)
{
	int flags = guess_name_flags(node);
	if (!modifiers_match(expected, flags) || expected->flags & NAME_STATIC)
		return 0;
	return !(flags & (NAME_FIELD | NAME_PARAMDECL));
}
Exemple #2
0
static inline bool inject_hotkey(void *data,
		size_t idx, obs_hotkey_binding_t *binding)
{
	UNUSED_PARAMETER(idx);
	struct obs_hotkey_internal_inject *event = data;

	if (modifiers_match(binding, event->hotkey.modifiers,
				event->strict_modifiers)) {
		bool pressed = binding->key.key == event->hotkey.key &&
			event->pressed;
		handle_binding(binding, event->hotkey.modifiers, false,
				event->strict_modifiers, &pressed);
	}

	return true;
}
Exemple #3
0
static inline void handle_binding(obs_hotkey_binding_t *binding,
		uint32_t modifiers, bool no_press, bool strict_modifiers,
		bool *pressed)
{
	bool modifiers_match_ = modifiers_match(binding, modifiers,
							strict_modifiers);
	bool modifiers_only   = binding->key.key == OBS_KEY_NONE;

	if (!binding->key.modifiers)
		binding->modifiers_match = true;

	if (modifiers_only)
		pressed = &modifiers_only;

	if (!binding->key.modifiers && modifiers_only)
		goto reset;

	if ((!binding->modifiers_match && !modifiers_only) || !modifiers_match_)
		goto reset;

	if ((pressed && !*pressed) ||
			(!pressed && !is_pressed(binding->key.key)))
		goto reset;

	if (binding->pressed || no_press)
		return;

	press_released_binding(binding);
	return;

reset:
	binding->modifiers_match = modifiers_match_;
	if (!binding->pressed)
		return;

	release_pressed_binding(binding);
}