binds: add drag_threshold for click/drag isolation (#9839)
--------- Co-authored-by: Leeman <lstrout@enlj.com>
This commit is contained in:
parent
0399e64274
commit
6538970087
7 changed files with 103 additions and 41 deletions
|
|
@ -651,6 +651,7 @@ CConfigManager::CConfigManager() {
|
|||
registerConfigVar("binds:disable_keybind_grabbing", Hyprlang::INT{0});
|
||||
registerConfigVar("binds:window_direction_monitor_fallback", Hyprlang::INT{1});
|
||||
registerConfigVar("binds:allow_pin_fullscreen", Hyprlang::INT{0});
|
||||
registerConfigVar("binds:drag_threshold", Hyprlang::INT{0});
|
||||
|
||||
registerConfigVar("gestures:workspace_swipe", Hyprlang::INT{0});
|
||||
registerConfigVar("gestures:workspace_swipe_fingers", Hyprlang::INT{3});
|
||||
|
|
@ -2255,6 +2256,8 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
|
|||
bool longPress = false;
|
||||
bool hasDescription = false;
|
||||
bool dontInhibit = false;
|
||||
bool click = false;
|
||||
bool drag = false;
|
||||
const auto BINDARGS = command.substr(4);
|
||||
|
||||
for (auto const& arg : BINDARGS) {
|
||||
|
|
@ -2280,6 +2283,12 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
|
|||
hasDescription = true;
|
||||
} else if (arg == 'p') {
|
||||
dontInhibit = true;
|
||||
} else if (arg == 'c') {
|
||||
click = true;
|
||||
release = true;
|
||||
} else if (arg == 'g') {
|
||||
drag = true;
|
||||
release = true;
|
||||
} else {
|
||||
return "bind: invalid flag";
|
||||
}
|
||||
|
|
@ -2291,6 +2300,9 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
|
|||
if (mouse && (repeat || release || locked))
|
||||
return "flag m is exclusive";
|
||||
|
||||
if (click && drag)
|
||||
return "flags c and g are mutually exclusive";
|
||||
|
||||
const int numbArgs = hasDescription ? 5 : 4;
|
||||
const auto ARGS = CVarList(value, numbArgs);
|
||||
|
||||
|
|
@ -2350,7 +2362,8 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
|
|||
|
||||
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});
|
||||
mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit,
|
||||
click, drag});
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue