clang format

This commit is contained in:
littleblack111 2024-11-07 13:34:14 +08:00 committed by Vaxry
parent 6b9a9af9a8
commit 5fd7755b8d
4 changed files with 34 additions and 36 deletions

View file

@ -2265,9 +2265,9 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
return "Invalid catchall, catchall keybinds are only allowed in submaps.";
}
g_pKeybindManager->addKeybind(SKeybind{
parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER, COMMAND, locked, m_szCurrentSubmap, DESCRIPTION, release,
repeat, longPress, mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit});
g_pKeybindManager->addKeybind(SKeybind{parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER,
COMMAND, locked, m_szCurrentSubmap, DESCRIPTION, release, repeat, longPress,
mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit});
}
return {};

View file

@ -852,9 +852,9 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
"dispatcher": "{}",
"arg": "{}"
}},)#",
kb.locked ? "true" : "false", kb.mouse ? "true" : "false", kb.release ? "true" : "false", kb.repeat ? "true" : "false", kb.longPress ? "true" : "false", kb.nonConsuming ? "true" : "false",
kb.hasDescription ? "true" : "false", kb.modmask, escapeJSONStrings(kb.submap), escapeJSONStrings(kb.key), kb.keycode, kb.catchAll ? "true" : "false",
escapeJSONStrings(kb.description), escapeJSONStrings(kb.handler), escapeJSONStrings(kb.arg));
kb.locked ? "true" : "false", kb.mouse ? "true" : "false", kb.release ? "true" : "false", kb.repeat ? "true" : "false", kb.longPress ? "true" : "false",
kb.nonConsuming ? "true" : "false", kb.hasDescription ? "true" : "false", kb.modmask, escapeJSONStrings(kb.submap), escapeJSONStrings(kb.key), kb.keycode,
kb.catchAll ? "true" : "false", escapeJSONStrings(kb.description), escapeJSONStrings(kb.handler), escapeJSONStrings(kb.arg));
}
trimTrailingComma(ret);
ret += "]";

View file

@ -131,26 +131,25 @@ CKeybindManager::CKeybindManager() {
m_tScrollTimer.reset();
m_pLongPressTimer = makeShared<CEventLoopTimer>(
std::nullopt,
[this](SP<CEventLoopTimer> self, void* data) {
SKeybind** ppActiveKeybind = (SKeybind**)m_pActiveKeybind;
m_pLongPressTimer = makeShared<CEventLoopTimer>(
std::nullopt,
[this](SP<CEventLoopTimer> self, void* data) {
SKeybind** ppActiveKeybind = (SKeybind**)m_pActiveKeybind;
if (!m_pActiveKeybind)
return 0;
if (!m_pActiveKeybind)
return 0;
// if (!*ppActiveKeybind || g_pSeatManager->keyboard.expired())
// return 0;
// if (!*ppActiveKeybind || g_pSeatManager->keyboard.expired())
// return 0;
// const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find((*ppActiveKeybind)->handler);
// const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find((*ppActiveKeybind)->handler);
// Debug::log(LOG, "Keybind long press triggered, calling dispatcher.");
// DISPATCHER->second((*ppActiveKeybind)->arg);
},
nullptr
);
// Debug::log(LOG, "Keybind long press triggered, calling dispatcher.");
// DISPATCHER->second((*ppActiveKeybind)->arg);
},
nullptr);
g_pEventLoopManager->addTimer(m_pLongPressTimer);
g_pEventLoopManager->addTimer(m_pLongPressTimer);
static auto P = g_pHookSystem->hookDynamic("configReloaded", [this](void* hk, SCallbackInfo& info, std::any param) {
// clear cuz realloc'd
@ -162,10 +161,10 @@ CKeybindManager::CKeybindManager() {
CKeybindManager::~CKeybindManager() {
if (m_pXKBTranslationState)
xkb_state_unref(m_pXKBTranslationState);
if (m_pLongPressTimer && g_pEventLoopManager) {
g_pEventLoopManager->removeTimer(m_pLongPressTimer);
m_pLongPressTimer.reset();
}
if (m_pLongPressTimer && g_pEventLoopManager) {
g_pEventLoopManager->removeTimer(m_pLongPressTimer);
m_pLongPressTimer.reset();
}
}
void CKeybindManager::addKeybind(SKeybind kb) {
@ -594,7 +593,6 @@ int repeatKeyHandler(void* data) {
}
int longPressHandler(SP<CEventLoopTimer> self, void* data) {
return 0;
}
@ -713,16 +711,16 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
continue;
}
if (k.longPress) {
m_pActiveKeybind = &k;
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
if (k.longPress) {
m_pActiveKeybind = &k;
m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay));
// m_pLastLongPressKeybind = &k;
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
// continue;
}
m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay));
// m_pLastLongPressKeybind = &k;
// continue;
}
if (!pressed) {
// Require mods to be matching when the key was first pressed.
@ -771,7 +769,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
found = true; // don't process keybinds on submap change.
break;
}
}
}
if (k.repeat) {
m_pActiveKeybind = &k;

View file

@ -122,7 +122,7 @@ class CKeybindManager {
inline static std::string m_szCurrentSelectedSubmap = "";
SKeybind* m_pActiveKeybind = nullptr;
SP<CEventLoopTimer> m_pLongPressTimer;
SP<CEventLoopTimer> m_pLongPressTimer;
uint32_t m_uTimeLastMs = 0;
uint32_t m_uLastCode = 0;