Re: [crossfire] [PATCH 0/2] Work on keys.c and the keybinding system

2013-11-03 Thread Kevin Zheng
On 11/02/2013 18:21, Arvid Brodin wrote:
 I think we should still remove the functionality that allows one 
 to rebind the modifier keys, for two reasons:
 
 * It doesn't seem to work. Try it out on rev 19089 - the bind is
   successful (when you press the bound key the corresponding Run/
   Shift indicator lights up), but as soon as you press a direction
   key, the Run/Fire modifier is lost, and you only get a normal 
   direction press.

This seems like a very compelling reason to me. I vote that we go ahead
and make the change.

 * Patch #2 introduces character-specific keys files. It would be
   nice to take the opportunity to change the format of that file
   in the same go, to correspond with the Ctrl and Shift keys (so
   C for Ctrl, instead of todays R for run, etc).

Yes, this change makes sense if control keys can't be rebound.

Thanks,
Kevin Zheng
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


Re: [crossfire] [PATCH 1/2] Keybindings: multiple changes

2013-11-03 Thread Kevin Zheng
On 11/03/2013 08:50, Arvid Brodin wrote:
 I see what you mean - suddenly there's a lot of noise in the keybindings
 dialog. What I did was to remove all bindings that I don't use, and it feels 
 OK now. Perhaps that'll work for you as well? If you try it and still hate
 it, tell me and I'll see what I can do. :)

It's not too bad. Since most of my personal key bindings are applied
with the ALT key, I can just sort the list by modifier.

 I will also submit a cleaned-up version of the common/def-keys file. There 
 are some obvious clean-ups and some maybe: 
 
 - 3 bindings of 'a' to apply (to handle different shift state and modifier 
   states). Replace with a single binding of 'a' with Any flag.

In hindsight, there are some issues with setting the directional keys
with the Any flag. I usually bind ALT-B to 'cast burning hands', but
it conflicts with the 'Any' definition of a NetHack-style direction key.
Perhaps the 'Normal' checkbox should come back?

 - 2 of 'e' to examine (shift state). Replace with single binding of 'e'.

There should just be one examine command, examine. I think it should
be bound to normal and CTRL.

 - What's the difference between the take and the pickup commands? (',', 
   '@')

The 'pickup' binding should probably go. In NetHack, '@' toggles
auto-pickup, but Crossfire's 'pickup' command requires an argument.
Perhaps it was left over from a long time ago.

 - How often do we get new players who use Sun Type 4 Keyboards? Perhaps these
   could go? (17 bindings.)

Admittedly, not that often. Binaries aren't even being built for modern
Sun machines (with normal keyboards).

 - Is there a difference between rotateshoottype - and rotateshoottype -1?
   Also needs modifier flags cleanup (A/N/NF).

Not exactly sure, they *seem* to do the same :p

 These I don't really know about:
 
 - I've never seen the Nethack-Style key layout before. Also, they don't seem
   to work in conjunction with the Fire modifier (only N and R). Does the fact
   that that bug has never been fixed mean they aren't used at all, perhaps? Or
   do people just fix that when they start to play?

I've always used NetHack style keys, and they've been working fine all
the time. After the update some interesting things are happening, which
I'm working on investigating.

 - Arrow keys... I *really* like the feature of command history and the 
 prevkey/
   nextkey that is available. But these are not bound by default, so perhaps 
 they
   aren't used as much as they could be. On the other hand, using the arrow 
 keys
   for this (and not for north/south etc) requires an immidiate help text 
 whenever
   a new character is started, to explain how to move.

Thing with Crossfire is that we don't have a pop-up-on-your-screen
tutorial at the beginning. And if players start by using the arrow keys
(based on intuition), they probably won't discover the other ways to
move, either.

Thanks,
Kevin Zheng
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


Re: [crossfire] [PATCH 1/2] Keybindings: multiple changes

2013-11-03 Thread Arvid Brodin
On 2013-11-03 18:15, Arvid Brodin wrote:
 On 2013-11-03 16:50, Kevin Zheng wrote:
 On 11/03/2013 08:50, Arvid Brodin wrote:
 
 []
 
 - 3 bindings of 'a' to apply (to handle different shift state and 
 modifier 
   states). Replace with a single binding of 'a' with Any flag.

 In hindsight, there are some issues with setting the directional keys
 with the Any flag. I usually bind ALT-B to 'cast burning hands', but
 it conflicts with the 'Any' definition of a NetHack-style direction key.
 Perhaps the 'Normal' checkbox should come back?
 
 It does conflict. Before, you were allowed to enter conflicting keybindings,
 and now, you are not. The order the keybinds were made mattered before. Look
 at parse_key() in the old code. They find several matches: first_match, then
 tries to find a perfect match (keyentry), then proceeds to completely ignore
 the keyentry match...
 

I took another look at this code and the keyentry isn't ignoread at all. The
code actually searches through the bindings to find a perfect match - if 
no such match is found, it selects the first match found that matches any of
the key modifier flags set.

-- 
Arvid
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


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

2013-11-03 Thread Mark Wedel

On 11/ 2/13 08:14 PM, Kevin Zheng wrote:

On 11/02/2013 11:04, Arvid Brodin wrote:



I noticed the gtk client code is split between the folders common/
and gtk-v2/. I found references to something called the x11 client
in the code, and I assumed that that was an old client that had since
been removed. It was apparently called cfclient, later renamed
crossfire-client-x11. If this has been removed, perhaps it would be a
good idea to merge the common/ folder into the gtk-v2/ folder?


You've probably noticed that the sources in common/ are built into a
shared library. The intention was to share some code between the several
different versions of the client (X11, SDL, OpenGL, GTKv1, GTKv2). Now,
it seems a little unnecessary (unless someone decides to bring back
another client).


 But to me, there is very little reason to merge them - the common area vs the 
specific graphic area are pretty well abstracted apart.


 And while right now there might only be one graphics client that uses it, if 
they get merged, that pretty much would mean that would always be the case.


 In terms of history, early version of the client only had X11 client support - 
the fact it was separated made it possible to have different GUI clients at 
different times (gtkv1 vs gtkv2, and I think there was a gnome client at some 
point).


 Now whether there will ever be new graphics system ever added the the C client 
(vs java), who knows, but off the top of my head, I could think of several 
platforms where a native GUI client could be written, and who knows what changes 
may show up even on the unix desktops which might bring forth a new client with 
new toolkit.


 If there are specific issues or problems trying to be addressed by merging 
them together, that would be good to hear (and perhaps could be fixed without a 
merge).  But just merging them for the sake of merging may not be good long term.


___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


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

2013-11-03 Thread Mark Wedel

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)


 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.



___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


Re: [crossfire] [PATCH 1/2] Keybindings: multiple changes

2013-11-03 Thread Mark Wedel

On 11/ 3/13 06:50 AM, Arvid Brodin wrote:
snip


- How often do we get new players who use Sun Type 4 Keyboards? Perhaps these
   could go? (17 bindings.)


 Some of those still can apply for later sun keyboards (using a type 7 here). 
Since later keyboards are USB, they work fine on PCs also.


 I suspect the F ones can certainly go.

 The KP_name seem to depend on if numlock is on or off, so in theory can go, 
but at same time, I suspect would apply to non sun keyboards if numlock is off. 
 That said, hitting numlock is not hard, although perhaps a warning in the 
client could be added (Your numlock key is off - movement via the keypad will 
not work until you turn it on) type of thing.  I believe there is some way to 
get that status with gtk.




These I don't really know about:

- I've never seen the Nethack-Style key layout before. Also, they don't seem
   to work in conjunction with the Fire modifier (only N and R). Does the fact
   that that bug has never been fixed mean they aren't used at all, perhaps? Or
   do people just fix that when they start to play?


 Not specific to that, but I suspect people playing on laptops/notebooks lack 
the numeric keypad, and just using the 4 direction keys is limiting (there are 
probably circumstances where you really need to move or fire diagonally)




- Arrow keys... I *really* like the feature of command history and the prevkey/
   nextkey that is available. But these are not bound by default, so perhaps 
they
   aren't used as much as they could be. On the other hand, using the arrow keys
   for this (and not for north/south etc) requires an immidiate help text 
whenever
   a new character is started, to explain how to move.


 I suspect some of that is command history is a more recent feature and 
keybinding was never added for it (there are probably lots of commands which 
could use keybindings but are lacking them)


 Certainly help text could be updated.  I wonder if they could be bound to page 
up/page down by default (for keyboards that have that - see notebook issue 
above) - this way, they will still apply in keybindings for all users, so people 
could rebind them to other keys as they see fit.


___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


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

2013-11-03 Thread Arvid Brodin
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
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


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

2013-11-03 Thread Kevin Zheng
On 11/03/2013 13:36, Mark Wedel wrote:
  Just a question - is there any way to set up 'global' keybindings (eg,
 those that apply to all characters)?

This does seem useful. One possible idea to throw around is to make the
key bindings window tabbed, one for per-character and one for global. If
there's a conflict, prefer the per-character binding.

Of course, this is easier said than done.

Thanks,
Kevin Zheng
___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire