[crossfire] [PATCH 2/2] Character-specific keybinding files

Arvid Brodin arvidb at kth.se
Sun Nov 3 14:40:18 CST 2013


On 2013-11-03 20:36, Mark Wedel wrote:
> On 11/ 2/13 04:31 PM, Arvid Brodin wrote:
>> Today, keybindings are saved as ~/.crossfire/keys. That means you
>> cannot have different key bindings for each character.
>>
>> This patch changes that so that keybindings are saved as
>> ~/.crossfire/<character-name>.keys. So if your character is named
>> Leopold, the keybindings are saved to ~/.crossfire/Leopold.keys.
>>
>> When play is entered with a character, the client tries to load
>> keybindings in the following order:
>>
>> ~/.crossfire/<character-name>.keys
>> ~/.crossfire/keys
>> <client_libdir>/def_keys
>>
>> If none of the files are found, it instead uses the default built-
>> in keybindings.
> 
>  Just a question - is there any way to set up 'global' keybindings (eg, those that apply to all characters)?
> 
>  From my reading above, which may not be correct, it suggests that once it finds a matching keys file, it won't go to the next one (so if you have a foobar.keys file, it will load that and won't load anything you have set up in keys).
> 
>  I'm not sure how prevalent it is, but I know for myself that I have some keybindings that would apply to all characters, and it would be a bit of a pain to re-enter them each time a new character is created (now I suppose this can be done as a manual process of having a template file that I manually copy over as I make new characters)

When you start play with a new character, the <client_libdir>/def_keys 
would be loaded, or ~/.crossfire/keys if you have such a file. So you 
won't start without any keybindings.

I have not added a way to configure "global" keys for all characters. 
How would you handle the case where a new or modified global key binding 
conflicts with a character-specific binding (also see below)?

Also, I've not added an in-game way to say "use the current key bindings
for all new characters". This could be done manually by copying a 
character's .keys file to ~/.crossfire/keys, though.

> 
>  That said, certainly have per character keys file is also a good thing, since a lot of things are per character.
> 
>  My only thought here is that it loads up ~/.crossfire/keys regardless, but values in <char name>.keys override any settings there, and in the bind window, have an option for the keybinding which is something like 'global (all character)' option.

One would have to figure out how the override should be done. Say you 
have Kevin Zheng's case where the direction keys are "Any" - i.e. they
should work regardless of modifier state. Then add binding for Alt-'b' 
which conflicts with the Any binding for 'b' - should we then make the 
direction key 'b' work with any modifier state (None, Ctrl, Shift, Meta,
Ctrl+Shift, Ctrl+Alt, Shift+Alt, Ctrl+Shift+Alt, Meta+...) except 
Alt-'b'? Or should the direction key 'b' be overridden completely?


-- 
Arvid


More information about the crossfire mailing list