mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 08:23:50 -04:00
g13d: Add in the ability to unbind keys
This allows us to unbind keys and leave them natural in the GUI.
This commit is contained in:
parent
b2576707ea
commit
b9000dd5a9
@ -118,6 +118,10 @@ class Actionable {
|
|||||||
return _parent_ptr->manager();
|
return _parent_ptr->manager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void clear_action() {
|
||||||
|
_action.reset();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void set_action(const ActionPtr &action) {
|
virtual void set_action(const ActionPtr &action) {
|
||||||
_action = action;
|
_action = action;
|
||||||
}
|
}
|
||||||
|
@ -434,6 +434,23 @@ void Device::_init_commands() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G13_DEVICE_COMMAND(unbind) {
|
||||||
|
std::string keyname = remainder;
|
||||||
|
try {
|
||||||
|
if (auto key = _current_profile->find_key(keyname)) {
|
||||||
|
key->clear_action();
|
||||||
|
} else if (auto stick_key = _stick.zone(keyname)) {
|
||||||
|
stick_key->clear_action();
|
||||||
|
} else {
|
||||||
|
RETURN_FAIL("unbind key " << keyname << " unknown");
|
||||||
|
}
|
||||||
|
G13_LOG(trace, "unbind " << keyname);
|
||||||
|
} catch (const std::exception &ex) {
|
||||||
|
RETURN_FAIL("unbind " << keyname
|
||||||
|
<< " failed : " << ex.what())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
G13_DEVICE_COMMAND(profile) {
|
G13_DEVICE_COMMAND(profile) {
|
||||||
switch_to_profile(remainder);
|
switch_to_profile(remainder);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user