Skip to content

Commit

Permalink
Add to_event_definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Dec 10, 2024
1 parent 27e7ca0 commit 4a13283
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
14 changes: 7 additions & 7 deletions src/share/manipulator/manipulators/basic/basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class basic final : public base, public pqrs::dispatcher::extra::dispatcher_clie

// For simple_modifications
basic(const from_event_definition& from,
const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& to)
const to_event_definitions& to)
: base(),
dispatcher_client(),
parameters_(std::make_shared<core_configuration::details::complex_modifications_parameters>()),
Expand Down Expand Up @@ -704,15 +704,15 @@ class basic final : public base, public pqrs::dispatcher::extra::dispatcher_clie
return from_;
}

const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& get_to(void) const {
const to_event_definitions& get_to(void) const {
return to_;
}

const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& get_to_after_key_up(void) const {
const to_event_definitions& get_to_after_key_up(void) const {
return to_after_key_up_;
}

const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& get_to_if_alone(void) const {
const to_event_definitions& get_to_if_alone(void) const {
return to_if_alone_;
}

Expand Down Expand Up @@ -765,9 +765,9 @@ class basic final : public base, public pqrs::dispatcher::extra::dispatcher_clie
gsl::not_null<std::shared_ptr<const core_configuration::details::complex_modifications_parameters>> parameters_;

from_event_definition from_;
std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_;
std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_after_key_up_;
std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_if_alone_;
to_event_definitions to_;
to_event_definitions to_after_key_up_;
to_event_definitions to_if_alone_;
std::shared_ptr<to_if_held_down> to_if_held_down_;
std::shared_ptr<to_delayed_action> to_delayed_action_;

Expand Down
8 changes: 5 additions & 3 deletions src/share/manipulator/manipulators/basic/event_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace manipulator {
namespace manipulators {
namespace basic {
namespace event_sender {
inline bool is_last_to_event_modifier_key_event(const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& to_events) {

inline bool is_last_to_event_modifier_key_event(const to_event_definitions& to_events) {
if (to_events.empty()) {
return false;
}
Expand Down Expand Up @@ -109,7 +110,7 @@ inline void post_from_mandatory_modifiers_key_down(const event_queue::entry& fro
}

inline void post_events_at_key_down(const event_queue::entry& front_input_event,
const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& to_events,
const to_event_definitions& to_events,
manipulated_original_event::manipulated_original_event& current_manipulated_original_event,
absolute_time_duration& time_stamp_delay,
event_queue::queue& output_event_queue) {
Expand Down Expand Up @@ -234,7 +235,7 @@ inline void post_events_at_key_up(const event_queue::entry& front_input_event,
}

inline void post_extra_to_events(const event_queue::entry& front_input_event,
const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& to_events,
const to_event_definitions& to_events,
manipulated_original_event::manipulated_original_event& current_manipulated_original_event,
absolute_time_duration& time_stamp_delay,
event_queue::queue& output_event_queue) {
Expand Down Expand Up @@ -324,6 +325,7 @@ inline void post_active_modifier_flags(const event_queue::entry& front_input_eve
output_event_queue);
}
}

} // namespace event_sender
} // namespace basic
} // namespace manipulators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class simultaneous_options final {
return key_up_when_;
}

const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& get_to_after_key_up(void) const {
const to_event_definitions& get_to_after_key_up(void) const {
return to_after_key_up_;
}

Expand All @@ -118,7 +118,7 @@ class simultaneous_options final {
key_order key_down_order_;
key_order key_up_order_;
key_up_when key_up_when_;
std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_after_key_up_;
to_event_definitions to_after_key_up_;
};

inline void from_json(const nlohmann::json& json, simultaneous_options::key_order& value) {
Expand Down
10 changes: 5 additions & 5 deletions src/share/manipulator/manipulators/basic/to_delayed_action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ class to_delayed_action final : public pqrs::dispatcher::extra::dispatcher_clien
detach_from_dispatcher();
}

const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& get_to_if_invoked(void) const {
const to_event_definitions& get_to_if_invoked(void) const {
return to_if_invoked_;
}

const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& get_to_if_canceled(void) const {
const to_event_definitions& get_to_if_canceled(void) const {
return to_if_canceled_;
}

Expand Down Expand Up @@ -140,7 +140,7 @@ class to_delayed_action final : public pqrs::dispatcher::extra::dispatcher_clien
}

private:
void post_events(const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& events) {
void post_events(const to_event_definitions& events) {
if (front_input_event_) {
if (current_manipulated_original_event_) {
if (auto oeq = output_event_queue_.lock()) {
Expand Down Expand Up @@ -182,8 +182,8 @@ class to_delayed_action final : public pqrs::dispatcher::extra::dispatcher_clien
current_manipulated_original_event_ = nullptr;
}

std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_if_invoked_;
std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_if_canceled_;
to_event_definitions to_if_invoked_;
to_event_definitions to_if_canceled_;
std::optional<event_queue::entry> front_input_event_;
std::shared_ptr<manipulated_original_event::manipulated_original_event> current_manipulated_original_event_;
std::weak_ptr<event_queue::queue> output_event_queue_;
Expand Down
4 changes: 2 additions & 2 deletions src/share/manipulator/manipulators/basic/to_if_held_down.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class to_if_held_down final : public pqrs::dispatcher::extra::dispatcher_client
detach_from_dispatcher();
}

const std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>>& get_to(void) const {
const to_event_definitions& get_to(void) const {
return to_;
}

Expand Down Expand Up @@ -134,7 +134,7 @@ class to_if_held_down final : public pqrs::dispatcher::extra::dispatcher_client
}

private:
std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_;
to_event_definitions to_;
std::optional<event_queue::entry> front_input_event_;
std::weak_ptr<manipulated_original_event::manipulated_original_event> current_manipulated_original_event_;
std::weak_ptr<event_queue::queue> output_event_queue_;
Expand Down
2 changes: 2 additions & 0 deletions src/share/manipulator/types/to_event_definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,7 @@ class to_event_definition final {
std::chrono::milliseconds hold_down_milliseconds_;
condition_manager condition_manager_;
};

typedef std::vector<gsl::not_null<std::shared_ptr<to_event_definition>>> to_event_definitions;
} // namespace manipulator
} // namespace krbn

0 comments on commit 4a13283

Please sign in to comment.