[crossfire] [RFC 2/3] Misc keybinding fixes and changes

Arvid Brodin arvidb at kth.se
Wed Oct 30 20:06:13 CDT 2013


On 2013-10-31 00:34, Kevin Zheng wrote:
> Due to a minor change (addition of braces in a 'for' loop) in the
> previous patch (RFC 1/3), the original patch no longer applies cleanly.
> 
> I've attached a resolved patch that should apply correctly now. Please
> tell me if something doesn't look right. Sorry for the confusion.

I get this diff of keys.c after applying my patch #1 vs your patch #1:

--- git-client/gtk-v2/src/keys.c        2013-10-31 01:57:39.109350292 +0100
+++ client-trunk/gtk-v2/src/keys.c      2013-10-31 01:51:03.551723009 +0100
@@ -186,11 +186,12 @@ static void insert_key(uint32 keysym, in
      * Try to find out if the command is a direction command.  If so, keep
      * track of this fact, so in fire or run mode, things work correctly.
      */
-    for (i = 0; i < 9; i++)
+    for (i = 0; i < 9; i++) {
         if (!strcmp(command, directions[i])) {
             direction = i;
             break;
         }
+    }
 
     newkey->keysym = keysym;
     newkey->flags = flags;
@@ -763,7 +764,7 @@ static void parse_key(char key, uint32 k
         return;
     }
     if (key >= '0' && key <= '9') {
-        cpl.count = cpl.count*10 + (key - '0');
+        cpl.count = cpl.count * 10 + (key - '0');
         if (cpl.count > 100000) {
             cpl.count %= 100000;
         }

It all looks good to me! Also, patch #3 applies with just some offset on top 
of the modified patches.

 
> On 10/28/2013 18:19, Arvid Brodin wrote:
>> * Add "Any" key modifier type; New "Any" button in keybindings dialog. This lets
>> the user choose between having a key work regardless of modifier (Ctrl, Alt, etc)
>> key states, or to use the same key with different modifiers for different 
>> bindings. How this worked before ("All"/"Normal") was pretty unclear, even in the
>> code comments. (New feature/bug fix.)
> 
> If "Any" is not checked, the key binding should retain its present
> behavior, correct? That is, the key only works when no modifiers are
> being pressed.

Correct.

 
>> * Removed possibility to rebind Ctrl, Shift, Alt, Meta modifiers. This feature
>> is very unusual and breaks the normal design pattern of using the designated 
>> keys as keyboard modifiers.
> 
> I'm not sure I understand the original problem. Could you please explain
> the rebinding part?

As a new player, I found this to be a usability problem. Everyone knows what
the Control key is, but what's the Run key? I think the reason Shift and Ctrl
were called Fire and Run is that it is possible to rebind them - i.e. if you 
want some other key to act as the Run modifier, you could

'bind runkey1

- and press a key to act as the Run modifier. (Actually I'm not even sure this
worked; I never tried it - and I'm pretty sure it requires the run_on state to 
be kept in the server, since key repeats won't work if you bind Run to, say, 
'r', and press that after the direction key... hmm. So it might be in the way
of better handling of repeating keys.)

I realise this change might not be liked by everyone, so feel free to shout out
in that case (RFC = Request For Comments). But it did seem like a pretty unique
and not very well advertised feature, so I chanced that it could be removed.



> 
> Thanks,
> Kevin Zheng
> 
> 
> 
> _______________________________________________
> crossfire mailing list
> crossfire at metalforge.org
> http://mailman.metalforge.org/mailman/listinfo/crossfire


-- 
Arvid


More information about the crossfire mailing list