mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-31 03:23:33 +02:00
wmaker: add new ModifierKeyShortLabels option
This patch is adding a new ModifierKeyShortLabels option to the WindowMaker file to let the user specify the modifier key labels used in the shortcuts like those appearing in the root menu. For example, to overwrite the default labels, a user can set the new option value to: ModifierKeyShortLabels = ( "\342\207\247", "\342\214\203", "\342\214\245", "\342\207\255", "\342\207\263", "\342\214\230", "\342\207\252", "\342\227\206", "\342\214\245" ); Which is using the same symbols as defined in macos. For example, instead of printing M4+, "\342\214\230" will print the ⌘ (Command) symbol.
This commit is contained in:
committed by
Carlos R. Mafra
parent
073235ada4
commit
66bf19c1e0
@@ -151,6 +151,7 @@ static WDECallbackUpdate setSwPOptions;
|
||||
static WDECallbackUpdate updateUsableArea;
|
||||
|
||||
static WDECallbackUpdate setModifierKeyLabels;
|
||||
static WDECallbackUpdate setModifierShortKeyLabels;
|
||||
static WDECallbackUpdate setHotCornerActions;
|
||||
|
||||
static WDECallbackConvert getCursor;
|
||||
@@ -624,6 +625,8 @@ WDefaultEntry optionList[] = {
|
||||
NULL, getPropList, setSwPOptions, NULL, NULL},
|
||||
{"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences,
|
||||
NULL, getPropList, setModifierKeyLabels, NULL, NULL},
|
||||
{"ModifierKeyShortLabels", "(\"Sh+\", \"^\", \"M1+\", \"M2+\", \"M3+\", \"M4+\", \"M5+\", \"M+\", \"A+\")", &wPreferences,
|
||||
NULL, getPropList, setModifierShortKeyLabels, NULL, NULL},
|
||||
{"FrameBorderWidth", "1", NULL,
|
||||
NULL, getInt, setFrameBorderWidth, NULL, NULL},
|
||||
{"FrameBorderColor", "black", NULL,
|
||||
@@ -3499,6 +3502,42 @@ static int setModifierKeyLabels(WScreen * scr, WDefaultEntry * entry, void *tdat
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setModifierShortKeyLabels(WScreen * scr, WDefaultEntry * entry, void *tdata, void *foo)
|
||||
{
|
||||
WMPropList *array = tdata;
|
||||
int i;
|
||||
struct WPreferences *prefs = foo;
|
||||
|
||||
if (!WMIsPLArray(array) || WMGetPropListItemCount(array) != 9) {
|
||||
wwarning(_("Value for option \"%s\" must be an array of 9 strings"), entry->key);
|
||||
WMReleasePropList(array);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DestroyWindowMenu(scr);
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
if (prefs->modifier_short_labels[i])
|
||||
wfree(prefs->modifier_short_labels[i]);
|
||||
|
||||
if (WMIsPLString(WMGetFromPLArray(array, i))) {
|
||||
prefs->modifier_short_labels[i] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array, i)));
|
||||
if (prefs->modifier_short_labels[i][0] == '\0') {
|
||||
wwarning(_("Invalid argument for option \"%s\" item %d, cannot be empty"), entry->key, i);
|
||||
wfree(prefs->modifier_short_labels[i]);
|
||||
prefs->modifier_short_labels[i] = NULL;
|
||||
}
|
||||
} else {
|
||||
wwarning(_("Invalid argument for option \"%s\" item %d"), entry->key, i);
|
||||
prefs->modifier_short_labels[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
WMReleasePropList(array);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setHotCornerActions(WScreen * scr, WDefaultEntry * entry, void *tdata, void *foo)
|
||||
{
|
||||
WMPropList *array = tdata;
|
||||
|
||||
Reference in New Issue
Block a user