Skip to content

useraction: port away from DEF macros

Nate Graham requested to merge ngraham/kwin:require-passing-name into master

Currently, defining shortcuts in useractions.cpp is done using one of six macros, some of which allow the name that ends up as the key in the config file to be autogenerated from an untranslated form of the user-facing text.

Whenever a shortcut using one of these macros is renamed, the key in the config file changes too, so users lose any custom shortcuts they had assigned.

To avoid this, developers need to know that they have to switch to the relevant macro that allows the name and description to be defined separately, remember to do so, and manually set a name that matches the old user-facing text. This can be forgotten, is not obvious to new developers, and is a subtle source of user-facing bugs.

In addition the macros are largely unnecessary, as they are wrappers around a custom function. We can just call the custom function ourselves.

This commit ports away from the macros and calls the initShortcut() instead, which resolves both issues.

cc @davidre

Edited by Nate Graham

Merge request reports