mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 12:26:00 +01:00
clang format
This commit is contained in:
parent
6b9a9af9a8
commit
5fd7755b8d
4 changed files with 34 additions and 36 deletions
|
@ -2265,9 +2265,9 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
|
||||||
return "Invalid catchall, catchall keybinds are only allowed in submaps.";
|
return "Invalid catchall, catchall keybinds are only allowed in submaps.";
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pKeybindManager->addKeybind(SKeybind{
|
g_pKeybindManager->addKeybind(SKeybind{parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER,
|
||||||
parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER, COMMAND, locked, m_szCurrentSubmap, DESCRIPTION, release,
|
COMMAND, locked, m_szCurrentSubmap, DESCRIPTION, release, repeat, longPress,
|
||||||
repeat, longPress, mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit});
|
mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -852,9 +852,9 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
"dispatcher": "{}",
|
"dispatcher": "{}",
|
||||||
"arg": "{}"
|
"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.locked ? "true" : "false", kb.mouse ? "true" : "false", kb.release ? "true" : "false", kb.repeat ? "true" : "false", kb.longPress ? "true" : "false",
|
||||||
kb.hasDescription ? "true" : "false", kb.modmask, escapeJSONStrings(kb.submap), escapeJSONStrings(kb.key), kb.keycode, kb.catchAll ? "true" : "false",
|
kb.nonConsuming ? "true" : "false", kb.hasDescription ? "true" : "false", kb.modmask, escapeJSONStrings(kb.submap), escapeJSONStrings(kb.key), kb.keycode,
|
||||||
escapeJSONStrings(kb.description), escapeJSONStrings(kb.handler), escapeJSONStrings(kb.arg));
|
kb.catchAll ? "true" : "false", escapeJSONStrings(kb.description), escapeJSONStrings(kb.handler), escapeJSONStrings(kb.arg));
|
||||||
}
|
}
|
||||||
trimTrailingComma(ret);
|
trimTrailingComma(ret);
|
||||||
ret += "]";
|
ret += "]";
|
||||||
|
|
|
@ -131,26 +131,25 @@ CKeybindManager::CKeybindManager() {
|
||||||
|
|
||||||
m_tScrollTimer.reset();
|
m_tScrollTimer.reset();
|
||||||
|
|
||||||
m_pLongPressTimer = makeShared<CEventLoopTimer>(
|
m_pLongPressTimer = makeShared<CEventLoopTimer>(
|
||||||
std::nullopt,
|
std::nullopt,
|
||||||
[this](SP<CEventLoopTimer> self, void* data) {
|
[this](SP<CEventLoopTimer> self, void* data) {
|
||||||
SKeybind** ppActiveKeybind = (SKeybind**)m_pActiveKeybind;
|
SKeybind** ppActiveKeybind = (SKeybind**)m_pActiveKeybind;
|
||||||
|
|
||||||
if (!m_pActiveKeybind)
|
if (!m_pActiveKeybind)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// if (!*ppActiveKeybind || g_pSeatManager->keyboard.expired())
|
// if (!*ppActiveKeybind || g_pSeatManager->keyboard.expired())
|
||||||
// return 0;
|
// 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.");
|
// Debug::log(LOG, "Keybind long press triggered, calling dispatcher.");
|
||||||
// DISPATCHER->second((*ppActiveKeybind)->arg);
|
// DISPATCHER->second((*ppActiveKeybind)->arg);
|
||||||
},
|
},
|
||||||
nullptr
|
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) {
|
static auto P = g_pHookSystem->hookDynamic("configReloaded", [this](void* hk, SCallbackInfo& info, std::any param) {
|
||||||
// clear cuz realloc'd
|
// clear cuz realloc'd
|
||||||
|
@ -162,10 +161,10 @@ CKeybindManager::CKeybindManager() {
|
||||||
CKeybindManager::~CKeybindManager() {
|
CKeybindManager::~CKeybindManager() {
|
||||||
if (m_pXKBTranslationState)
|
if (m_pXKBTranslationState)
|
||||||
xkb_state_unref(m_pXKBTranslationState);
|
xkb_state_unref(m_pXKBTranslationState);
|
||||||
if (m_pLongPressTimer && g_pEventLoopManager) {
|
if (m_pLongPressTimer && g_pEventLoopManager) {
|
||||||
g_pEventLoopManager->removeTimer(m_pLongPressTimer);
|
g_pEventLoopManager->removeTimer(m_pLongPressTimer);
|
||||||
m_pLongPressTimer.reset();
|
m_pLongPressTimer.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::addKeybind(SKeybind kb) {
|
void CKeybindManager::addKeybind(SKeybind kb) {
|
||||||
|
@ -595,7 +594,6 @@ int repeatKeyHandler(void* data) {
|
||||||
|
|
||||||
int longPressHandler(SP<CEventLoopTimer> self, void* data) {
|
int longPressHandler(SP<CEventLoopTimer> self, void* data) {
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,16 +711,16 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k.longPress) {
|
if (k.longPress) {
|
||||||
m_pActiveKeybind = &k;
|
m_pActiveKeybind = &k;
|
||||||
|
|
||||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||||
|
|
||||||
m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay));
|
m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay));
|
||||||
// m_pLastLongPressKeybind = &k;
|
// m_pLastLongPressKeybind = &k;
|
||||||
|
|
||||||
// continue;
|
// continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
// Require mods to be matching when the key was first 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.
|
found = true; // don't process keybinds on submap change.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k.repeat) {
|
if (k.repeat) {
|
||||||
m_pActiveKeybind = &k;
|
m_pActiveKeybind = &k;
|
||||||
|
|
|
@ -122,7 +122,7 @@ class CKeybindManager {
|
||||||
inline static std::string m_szCurrentSelectedSubmap = "";
|
inline static std::string m_szCurrentSelectedSubmap = "";
|
||||||
|
|
||||||
SKeybind* m_pActiveKeybind = nullptr;
|
SKeybind* m_pActiveKeybind = nullptr;
|
||||||
SP<CEventLoopTimer> m_pLongPressTimer;
|
SP<CEventLoopTimer> m_pLongPressTimer;
|
||||||
|
|
||||||
uint32_t m_uTimeLastMs = 0;
|
uint32_t m_uTimeLastMs = 0;
|
||||||
uint32_t m_uLastCode = 0;
|
uint32_t m_uLastCode = 0;
|
||||||
|
|
Loading…
Reference in a new issue