refactor: EiScreen sonar adjustments

This commit is contained in:
sithlord48 2025-06-19 22:20:36 -04:00 committed by Nick Bolton
parent a89f3b6892
commit 969b642e0b
2 changed files with 8 additions and 6 deletions

View file

@ -197,7 +197,7 @@ std::uint32_t EiScreen::registerHotKey(KeyID key, KeyModifierMask mask)
auto set = m_hotkeys.find(key); auto set = m_hotkeys.find(key);
if (set == m_hotkeys.end()) { if (set == m_hotkeys.end()) {
m_hotkeys.emplace(key, HotKeySet{key}); m_hotkeys.try_emplace(key, HotKeySet{key});
set = m_hotkeys.find(key); set = m_hotkeys.find(key);
} }
set->second.addItem(HotKeyItem(mask, id)); set->second.addItem(HotKeyItem(mask, id));
@ -207,8 +207,9 @@ std::uint32_t EiScreen::registerHotKey(KeyID key, KeyModifierMask mask)
void EiScreen::unregisterHotKey(uint32_t id) void EiScreen::unregisterHotKey(uint32_t id)
{ {
for (auto &set : m_hotkeys) { for (auto &[key, set] : m_hotkeys) {
if (set.second.removeById(id)) { (void)key;
if (set.removeById(id)) {
break; break;
} }
} }
@ -689,7 +690,7 @@ void EiScreen::onMotionEvent(ei_event *event)
} }
} }
void EiScreen::onAbsMotionEvent(const ei_event *event) const void EiScreen::onAbsMotionEvent(const ei_event *) const
{ {
assert(m_isPrimary); assert(m_isPrimary);
} }

View file

@ -11,6 +11,7 @@
#include "deskflow/PlatformScreen.h" #include "deskflow/PlatformScreen.h"
#include <libei.h> #include <libei.h>
#include <memory>
#include <mutex> #include <mutex>
#include <set> #include <set>
#include <vector> #include <vector>
@ -96,14 +97,14 @@ private:
void onPointerScrollEvent(ei_event *event); void onPointerScrollEvent(ei_event *event);
void onPointerScrollDiscreteEvent(ei_event *event); void onPointerScrollDiscreteEvent(ei_event *event);
void onMotionEvent(ei_event *event); void onMotionEvent(ei_event *event);
void onAbsMotionEvent(const ei_event *event) const; void onAbsMotionEvent(const ei_event *) const;
bool onHotkey(KeyID key, bool is_press, KeyModifierMask mask); bool onHotkey(KeyID key, bool is_press, KeyModifierMask mask);
void eiLogEvent(ei_log_priority priority, const char *message) const; void eiLogEvent(ei_log_priority priority, const char *message) const;
void handleConnectedToEisEvent(const Event &event); void handleConnectedToEisEvent(const Event &event);
void handlePortalSessionClosed(); void handlePortalSessionClosed();
static void handleEiLogEvent(ei *ei, ei_log_priority priority, const char *message, ei_log_context *context) static void handleEiLogEvent(ei *ei, const ei_log_priority priority, const char *message, ei_log_context *)
{ {
auto screen = static_cast<EiScreen *>(ei_get_user_data(ei)); auto screen = static_cast<EiScreen *>(ei_get_user_data(ei));
screen->eiLogEvent(priority, message); screen->eiLogEvent(priority, message);