[Freeciv-Dev] Re: Technical questions (numbered tile markers )
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Teemu Kurppa wrote:
I came up with some questions, when I was implementing a patch for
numbered tile markers.
1. GTK key events
Numbered tile markers can be used to mark important locations (among
other things) on the map and then jump between them. Obviously, number
keys are good candidates for shortcut keys to markers 1-10. I chose
shift+<num> to set a marker and ctrl+<num> to jump to a marker.
However, it seems that I can't implement this kind of behavior in truly
portable way. Xserver and thus GTK work in somewhat irritating way, when
producing key events. For example, if I press shift+8 (or ctrl+8), GTK
doesn't produce key event for a key code GDK_8 with SHIFT_MASK
set. Instead it produces a key event for a key code GDK_parenleft or
something else, if your keymap has been modified (xmodmap -pke tells
what).
Does anyone know a good solution to this problem ? If not, we have to
implement keyboard shortcuts for some particular keymap, and inform
players how to change their keymaps, if they differ.
One workaround would be to use different keys. What about F<num> to
jump to and ctrl-F<num> to set?
2. Other clients
Although I've implemented tile markers only for a non-isometric mode of
the GTK client, most of the code for tile markers is common to all
clients. However, there is one dependency from the common code to
the client specific code: function get_map_pos_under_mouse_pointer. I put
the declaration to client/include/mapctrl_g.h. I presume, that I need to
define dummy versions of this in all clients to make them compile, right ?
If you've added it to mapctrl_g.h then you must add at least a stub to
other functions. But be aware that if the code is called the stub must
behave intelligently. Also, I'm no GUI expert, but it looks to me like
such code can be used in multiple places throughout the GUI - but
perhaps such a thing already exists? I don't know.
Your get_map_pos_under_mouse_pointer uses a different structure from
most other map code. You malloc a map_position structure, and return it
to give the values. Most other code places the x and y values into
pointer parameters passed in, and returns TRUE or FALSE to indicate
whether the values have meaning. The only real problem with your way of
doing it is that it means youmust free() the pointer later.
jason
[Freeciv-Dev] Re: Technical questions (numbered tile markers ),
Jason Short <=
[Freeciv-Dev] Re: Technical questions (numbered tile markers ), Daniel Sjölie, 2002/01/09
[Freeciv-Dev] Re: Technical questions (numbered tile markers ), Raimar Falke, 2002/01/09
|
|