diff --git a/.gitignore b/.gitignore index f4b0b20..9e7f319 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ compile_commands.json .ccls-cache .ccls .direnv +result* diff --git a/flake.lock b/flake.lock index ed6b516..1278b1f 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1729527199, - "narHash": "sha256-D5/YksfRga8Akd04ZtIkuYSIOjXVrAzQIQBSeplokzU=", + "lastModified": 1731774881, + "narHash": "sha256-1Dxryiw8u2ejntxrrv3sMtIE8WHKxmlN4KeH+uMGbmc=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "8d732fa8aff8b12ef2b1e2f00fc8153e41312b72", + "rev": "b31a6a4da8199ae3489057db7d36069a70749a56", "type": "github" }, "original": { @@ -114,11 +114,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1729657195, - "narHash": "sha256-YGk7oeyyfvZs4d8qAyMBPg2J/euYK48hPiI6PLKEa30=", + "lastModified": 1732054045, + "narHash": "sha256-2DpSD0TvyaOVn4U8OjbOl0jj+25u62qjpztqo4LETHc=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "6e0aadc585c6d9fdaaebfa5853adbf9610897c82", + "rev": "c4eda46d0ef022a17348623beec4154ba34af691", "type": "github" }, "original": { @@ -193,11 +193,11 @@ ] }, "locked": { - "lastModified": 1728941256, - "narHash": "sha256-WRypmcZ2Bw94lLmcmxYokVOHPJSZ7T06V49QZ4tkZeQ=", + "lastModified": 1731702627, + "narHash": "sha256-+JeO9gevnXannQxMfR5xzZtF4sYmSlWkX/BPmPx0mWk=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "fd4be8b9ca932f7384e454bcd923c5451ef2aa85", + "rev": "e911361a687753bbbdfe3b6a9eab755ecaf1d9e1", "type": "github" }, "original": { @@ -233,11 +233,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729413321, - "narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=", + "lastModified": 1731676054, + "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26", + "rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add", "type": "github" }, "original": { @@ -249,11 +249,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1720386169, - "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", "type": "github" }, "original": { @@ -274,11 +274,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1729104314, - "narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=", + "lastModified": 1731363552, + "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", + "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", "type": "github" }, "original": { @@ -335,11 +335,11 @@ ] }, "locked": { - "lastModified": 1728166987, - "narHash": "sha256-w6dVTguAn9zJ+7aPOhBQgDz8bn6YZ7b56cY8Kg5HJRI=", + "lastModified": 1731703417, + "narHash": "sha256-rheDc/7C+yI+QspYr9J2z9kQ5P9F4ATapI7qyFAe1XA=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "fb9c8d665af0588bb087f97d0f673ddf0d501787", + "rev": "8070f36deec723de71e7557441acb17e478204d3", "type": "github" }, "original": { diff --git a/hyprpm.toml b/hyprpm.toml index ff5eddf..f9e264c 100644 --- a/hyprpm.toml +++ b/hyprpm.toml @@ -14,6 +14,7 @@ commit_pins = [ ["4520b30d498daca8079365bdb909a8dea38e8d55", "78eb74357b428498a8225b2d753b2fe9a463f89e"], # v0.44.1 ["f044e4c9514ec89c4c1fc8a523ca90b8cb907fb7", "070ca398300bf5b9e1a636ca057882c0312c228d"], # CMonitor* -> PHLMONITOR ["a425fbebe4cf4238e48a42f724ef2208959d66cf", "a86ed5581498186ed31241c0c246629ef771d1e6"], # v0.45.0 + ["12f9a0d0b93f691d4d9923716557154d74777b0a", "47f6fea6d297dbee8a9c5dea905783bde506fe79"], # v0.45.2 ] [hyprgrass] diff --git a/src/GestureManager.cpp b/src/GestureManager.cpp index e5c4864..09d60de 100644 --- a/src/GestureManager.cpp +++ b/src/GestureManager.cpp @@ -3,6 +3,7 @@ #include "wayfire/touch/touch.hpp" #include #include +#include #include #define private public @@ -200,33 +201,33 @@ bool GestureManager::handleGestureBind(std::string bind, bool pressed) { bool found = false; Debug::log(LOG, "[hyprgrass] Looking for binds matching: {}", bind); - auto allBinds = std::ranges::views::join(std::array{g_pKeybindManager->m_lKeybinds, this->internalBinds}); + auto allBinds = std::ranges::views::join(std::array{g_pKeybindManager->m_vKeybinds, this->internalBinds}); for (const auto& k : allBinds) { - if (k.key != bind) + if (k->key != bind) continue; - const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(k.mouse ? "mouse" : k.handler); + const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(k->mouse ? "mouse" : k->handler); // Should never happen, as we check in the ConfigManager, but oh well if (DISPATCHER == g_pKeybindManager->m_mDispatchers.end()) { - Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k.handler); + Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k->handler); continue; } // call the dispatcher Debug::log(LOG, "[hyprgrass] calling dispatcher ({})", bind); - if (k.handler == "pass") + if (k->handler == "pass") continue; - if (k.handler == "mouse") { - DISPATCHER->second((pressed ? "1" : "0") + k.arg); + if (k->handler == "mouse") { + DISPATCHER->second((pressed ? "1" : "0") + k->arg); } else { - DISPATCHER->second(k.arg); + DISPATCHER->second(k->arg); } - if (!k.nonConsuming) { + if (!k->nonConsuming) { found = true; } } @@ -519,9 +520,9 @@ void GestureManager::touchBindDispatcher(std::string args) { const auto dispatcher = trim(argsSplit[2]); const auto dispatcherArgs = trim(argsSplit[3]); - this->internalBinds.emplace_back(SKeybind{ + this->internalBinds.emplace_back(makeShared(SKeybind{ .key = key, .handler = dispatcher, .arg = dispatcherArgs, - }); + })); } diff --git a/src/GestureManager.hpp b/src/GestureManager.hpp index 6bbbc55..618efea 100644 --- a/src/GestureManager.hpp +++ b/src/GestureManager.hpp @@ -13,14 +13,13 @@ #include #undef private -#include #include #include class GestureManager : public IGestureManager { public: uint32_t long_press_next_trigger_time; - std::list internalBinds; + std::vector> internalBinds; GestureManager(); ~GestureManager(); diff --git a/src/main.cpp b/src/main.cpp index fc5ab97..82b8a27 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,6 +10,7 @@ #include #include +#include #include const CColor s_pluginColor = {0x61 / 255.0f, 0xAF / 255.0f, 0xEF / 255.0f, 1.0f}; @@ -39,10 +40,10 @@ static void onPreConfigReload() { void listInternalBinds(std::string) { Debug::log(LogLevel::LOG, "[hyprgrass] Listing internal binds:"); for (const auto& bind : g_pGestureManager->internalBinds) { - Debug::log(LogLevel::LOG, "[hyprgrass] | gesture: {}", bind.key); - Debug::log(LogLevel::LOG, "[hyprgrass] | dispatcher: {}", bind.handler); - Debug::log(LogLevel::LOG, "[hyprgrass] | arg: {}", bind.arg); - Debug::log(LogLevel::LOG, "[hyprgrass] | mouse: {}", bind.mouse); + Debug::log(LogLevel::LOG, "[hyprgrass] | gesture: {}", bind->key); + Debug::log(LogLevel::LOG, "[hyprgrass] | dispatcher: {}", bind->handler); + Debug::log(LogLevel::LOG, "[hyprgrass] | arg: {}", bind->arg); + Debug::log(LogLevel::LOG, "[hyprgrass] | mouse: {}", bind->mouse); Debug::log(LogLevel::LOG, "[hyprgrass] |"); } } @@ -67,12 +68,12 @@ Hyprlang::CParseResult onNewBind(const char* K, const char* V) { const auto dispatcher = mouse ? "mouse" : vars[2]; const auto dispatcherArgs = mouse ? vars[2] : vars[3]; - g_pGestureManager->internalBinds.emplace_back(SKeybind{ + g_pGestureManager->internalBinds.emplace_back(makeShared(SKeybind{ .key = key, .handler = dispatcher, .arg = dispatcherArgs, .mouse = mouse, - }); + })); return result; }