From 66946a83e65ae13e3ee5b3914ba19e15404143d7 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 1 Jun 2019 16:19:30 +0200 Subject: [PATCH] keyboard: Replace integer literals by bool when relevant Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html --- rpcs3/basic_keyboard_handler.cpp | 4 ++-- rpcs3/keyboard_pad_handler.cpp | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/rpcs3/basic_keyboard_handler.cpp b/rpcs3/basic_keyboard_handler.cpp index ac679729da..d261ff2307 100644 --- a/rpcs3/basic_keyboard_handler.cpp +++ b/rpcs3/basic_keyboard_handler.cpp @@ -73,7 +73,7 @@ void basic_keyboard_handler::keyPressEvent(QKeyEvent* keyEvent) keyEvent->ignore(); return; } - Key(keyEvent->key(), 1); + Key(keyEvent->key(), true); } void basic_keyboard_handler::keyReleaseEvent(QKeyEvent* keyEvent) @@ -83,7 +83,7 @@ void basic_keyboard_handler::keyReleaseEvent(QKeyEvent* keyEvent) keyEvent->ignore(); return; } - Key(keyEvent->key(), 0); + Key(keyEvent->key(), false); } void basic_keyboard_handler::LoadSettings() diff --git a/rpcs3/keyboard_pad_handler.cpp b/rpcs3/keyboard_pad_handler.cpp index dcc98acc3c..aea7148424 100644 --- a/rpcs3/keyboard_pad_handler.cpp +++ b/rpcs3/keyboard_pad_handler.cpp @@ -289,23 +289,23 @@ void keyboard_pad_handler::keyPressEvent(QKeyEvent* event) break; } } - processKeyEvent(event, 1); + processKeyEvent(event, true); } void keyboard_pad_handler::keyReleaseEvent(QKeyEvent* event) { - processKeyEvent(event, 0); + processKeyEvent(event, false); } void keyboard_pad_handler::mousePressEvent(QMouseEvent* event) { - Key(event->button(), 1); + Key(event->button(), true); event->ignore(); } void keyboard_pad_handler::mouseReleaseEvent(QMouseEvent* event) { - Key(event->button(), 0, 0); + Key(event->button(), false, 0); event->ignore(); } @@ -350,28 +350,28 @@ void keyboard_pad_handler::mouseMoveEvent(QMouseEvent* event) if (movement_x < 0) { - Key(mouse::move_right, 0); - Key(mouse::move_left, 1, std::min(m_deadzone_x + std::abs(movement_x), 255)); + Key(mouse::move_right, false); + Key(mouse::move_left, true, std::min(m_deadzone_x + std::abs(movement_x), 255)); m_last_mouse_move_left = std::chrono::steady_clock::now(); } else if (movement_x > 0) { - Key(mouse::move_left, 0); - Key(mouse::move_right, 1, std::min(m_deadzone_x + movement_x, 255)); + Key(mouse::move_left, false); + Key(mouse::move_right, true, std::min(m_deadzone_x + movement_x, 255)); m_last_mouse_move_right = std::chrono::steady_clock::now(); } // in Qt mouse up is equivalent to movement_y < 0 if (movement_y < 0) { - Key(mouse::move_down, 0); - Key(mouse::move_up, 1, std::min(m_deadzone_y + std::abs(movement_y), 255)); + Key(mouse::move_down, false); + Key(mouse::move_up, true, std::min(m_deadzone_y + std::abs(movement_y), 255)); m_last_mouse_move_up = std::chrono::steady_clock::now(); } else if (movement_y > 0) { - Key(mouse::move_up, 0); - Key(mouse::move_down, 1, std::min(m_deadzone_y + movement_y, 255)); + Key(mouse::move_up, false); + Key(mouse::move_down, true, std::min(m_deadzone_y + movement_y, 255)); m_last_mouse_move_down = std::chrono::steady_clock::now(); } @@ -614,22 +614,22 @@ void keyboard_pad_handler::ThreadProc() // roughly 1-2 frames to process the next mouse move if (elapsed_left > mouse_interval) { - Key(mouse::move_left, 0); + Key(mouse::move_left, false); m_last_mouse_move_left = now; } if (elapsed_right > mouse_interval) { - Key(mouse::move_right, 0); + Key(mouse::move_right, false); m_last_mouse_move_right = now; } if (elapsed_up > mouse_interval) { - Key(mouse::move_up, 0); + Key(mouse::move_up, false); m_last_mouse_move_up = now; } if (elapsed_down > mouse_interval) { - Key(mouse::move_down, 0); + Key(mouse::move_down, false); m_last_mouse_move_down = now; }