[Scummvm-devel] Keymapper code

Max Horn max at quendi.de
Tue May 12 21:22:10 CEST 2009


Hi there,

I see that Eugene put lots of work into reviving the keymapper code.  
Great!

However, the keymapper still suffers from some questionable design  
choices in my eyes. Some points:

* Why does HardwareKeySet store a list of HardwareKey *pointers*  
instead of the objects themselves?

This is bad because it puts a lot of extra pressure on the heap, and  
always increases the risk of memory leaks.
The only reason I can think of why this might be good: To make it  
possible to subclass HardwareKey. OK, fine, but that's not done, is  
it? Why would one do it? Why doesn't have HardwareKey a virtual  
destructor then?

My suggestion: Just change it


* Currently one "hardware key" for every key combo is created. I.e.,  
"A" and "Ctrl-A" are handled as if they were different keys. While  
that certainly simplifies some things, it also means that for every  
new modifier key we add, the number of "keys" is doubled. Can't we  
teach the remapper about modifier keys instead?


* If I enable the key remapper, ScummVM gets super crashy for me. For  
example, in the launcher, if I press "return" to start the select  
game, instead it'll crash with an insertion triggered by an invalid  
Common::Rect.



Bye,
Max




More information about the Scummvm-devel mailing list