From 507c98adffe3c64b495f3c0a1c51eead7ddeb8a6 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Mon, 1 Sep 2025 09:16:33 -0400 Subject: [PATCH] refactor: EIKeyState::fakeKey use if in place of a switch that cares only about a single case --- src/lib/platform/EiKeyState.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/lib/platform/EiKeyState.cpp b/src/lib/platform/EiKeyState.cpp index a12361bfa..8ea571663 100644 --- a/src/lib/platform/EiKeyState.cpp +++ b/src/lib/platform/EiKeyState.cpp @@ -277,17 +277,14 @@ void EiKeyState::getKeyMap(deskflow::KeyMap &keyMap) void EiKeyState::fakeKey(const Keystroke &keystroke) { - switch (keystroke.m_type) { - case Keystroke::KeyType::Button: - LOG_DEBUG1( - "fake key: %03x (%08x) %s", keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_client, - keystroke.m_data.m_button.m_press ? "down" : "up" - ); - m_screen->fakeKey(keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_press); - break; - default: - break; - } + if (keystroke.m_type != Keystroke::KeyType::Button) + return; + + LOG_DEBUG1( + "fake key: %03x (%08x) %s", keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_client, + keystroke.m_data.m_button.m_press ? "down" : "up" + ); + m_screen->fakeKey(keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_press); } KeyID EiKeyState::mapKeyFromKeyval(uint32_t keyval) const