aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp19
-rw-r--r--src/SearchBar.cpp3
2 files changed, 19 insertions, 3 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 3e77797..c2a7c6b 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -4528,6 +4528,9 @@ namespace QuickMedia {
std::deque<int> comment_navigation_stack;
std::deque<int> comment_page_scroll_stack;
+ bool moving_captcha_left = false;
+ bool moving_captcha_right = false;
+
mgl::Clock frame_timer;
while (current_page == PageType::IMAGE_BOARD_THREAD && window.is_open()) {
const float frame_elapsed_time_sec = frame_timer.restart();
@@ -4556,6 +4559,18 @@ namespace QuickMedia {
idle_active_handler();
}
+ if(event.type == mgl::Event::KeyPressed) {
+ if(event.key.code == mgl::Keyboard::Left)
+ moving_captcha_left = true;
+ if(event.key.code == mgl::Keyboard::Right)
+ moving_captcha_right = true;
+ } else if(event.type == mgl::Event::KeyReleased) {
+ if(event.key.code == mgl::Keyboard::Left)
+ moving_captcha_left = false;
+ if(event.key.code == mgl::Keyboard::Right)
+ moving_captcha_right = false;
+ }
+
if(event.type == mgl::Event::Resized || event.type == mgl::Event::GainedFocus)
redraw = true;
else if(navigation_stage == NavigationStage::VIEWING_COMMENTS && event.type == mgl::Event::KeyPressed) {
@@ -4924,11 +4939,11 @@ namespace QuickMedia {
if(navigation_stage == NavigationStage::SOLVING_POST_CAPTCHA && captcha_texture.is_valid()) {
const float slide_speed = 0.5f;
const bool window_has_focus = window.has_focus();
- if(window_has_focus && window.is_key_pressed(mgl::Keyboard::Left)) {
+ if(window_has_focus && moving_captcha_left) {
captcha_slide -= (slide_speed * frame_elapsed_time_sec);
if(captcha_slide < 0.0f)
captcha_slide = 0.0f;
- } else if(window_has_focus && window.is_key_pressed(mgl::Keyboard::Right)) {
+ } else if(window_has_focus && moving_captcha_right) {
captcha_slide += (slide_speed * frame_elapsed_time_sec);
if(captcha_slide > 1.0f)
captcha_slide = 1.0f;
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 52e75e6..2371762 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -131,7 +131,8 @@ namespace QuickMedia {
return;
}
- if((window.is_key_pressed(mgl::Keyboard::LControl) || window.is_key_pressed(mgl::Keyboard::RControl)) && (event.type != mgl::Event::TextEntered || event.text.codepoint != 13)) // Enter
+ const bool pressing_ctrl = (event.type == mgl::Event::KeyPressed && event.key.control);
+ if(pressing_ctrl && (event.type != mgl::Event::TextEntered || event.text.codepoint != 13)) // Enter
return;
if(event.type == mgl::Event::TextEntered && event.text.codepoint != 8 && event.text.codepoint != 127) { // 8 = backspace, 127 = del