aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-09-09 19:40:19 +0200
committerdec05eba <dec05eba@protonmail.com>2022-09-09 19:40:19 +0200
commit9c5cd0ebb51350c05d3fc3496851f43a209f84ec (patch)
tree64b09af13842ed36efefd78f71e77b6ef8e26aba /src/Body.cpp
parent6d9a07369a9ae20f73cf0d70cdf8b3e0cc06e87d (diff)
Do not require ctrl for vim keys for manga and matrix
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 5a72165..5de0c56 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -471,23 +471,24 @@ namespace QuickMedia {
}
}
- bool Body::on_event(const mgl::Window &window, const mgl::Event &event, bool keyboard_navigation) {
+ bool Body::on_event(const mgl::Window &window, const mgl::Event &event, bool keyboard_navigation, bool vim_keys_require_ctrl) {
if(keyboard_navigation && event.type == mgl::Event::KeyPressed && !event.key.alt) {
const bool rendering_card_view = card_view && card_view_enabled;
+ const bool vim_keys_valid = (vim_keys_require_ctrl && event.key.control) || !vim_keys_require_ctrl;
- if(event.key.code == mgl::Keyboard::Up || (event.key.control && event.key.code == mgl::Keyboard::K)) {
+ if(event.key.code == mgl::Keyboard::Up || (vim_keys_valid && event.key.code == mgl::Keyboard::K)) {
render_selected_item_bg = true;
bool top_reached = select_previous_item(true);
if(!top_reached && on_top_reached)
on_top_reached();
return true;
- } else if(event.key.code == mgl::Keyboard::Down || (event.key.control && event.key.code == mgl::Keyboard::J)) {
+ } else if(event.key.code == mgl::Keyboard::Down || (vim_keys_valid && event.key.code == mgl::Keyboard::J)) {
render_selected_item_bg = true;
bool bottom_reached = select_next_item(true);
if(!bottom_reached && on_bottom_reached)
on_bottom_reached();
return true;
- } else if(rendering_card_view && selected_column > 0 && ((!event.key.control && event.key.code == mgl::Keyboard::Left) || (event.key.control && event.key.code == mgl::Keyboard::H))) {
+ } else if(rendering_card_view && selected_column > 0 && ((!event.key.control && event.key.code == mgl::Keyboard::Left) || (vim_keys_valid && event.key.code == mgl::Keyboard::H))) {
render_selected_item_bg = true;
const int new_selected_item = get_previous_visible_item(selected_item);
if(new_selected_item != -1) {
@@ -496,7 +497,7 @@ namespace QuickMedia {
on_top_reached();
}
return true;
- } else if(rendering_card_view && selected_column + 1 < num_columns && ((!event.key.control && event.key.code == mgl::Keyboard::Right) || (event.key.control && event.key.code == mgl::Keyboard::L))) {
+ } else if(rendering_card_view && selected_column + 1 < num_columns && ((!event.key.control && event.key.code == mgl::Keyboard::Right) || (vim_keys_valid && event.key.code == mgl::Keyboard::L))) {
render_selected_item_bg = true;
const int new_selected_item = get_next_visible_item(selected_item);
if(new_selected_item != -1) {