[Scummvm-devel] Simplifying keyboard repeat

Max Horn max at quendi.de
Fri May 19 04:31:15 CEST 2006


Am 19.05.2006 um 13:18 schrieb Marcus Comstedt:

>
> Max Horn <max at quendi.de> writes:
>
>>> The SCUMM help text for example lists Ctrl 0-9, Alt 0-9, Alt x, Ctrl
>>> z, Alt Enter, Ctrl d, Ctrl s, Ctrl f, Ctrl g, Ctrl m, Ctrl Alt 1-8,
>>> Ctrl Alt +, Ctrl Alt - and Ctrl a.  Yet only a few of these are
>>> implemented by the SCUMM engine itself.
>>
>> You are mixing engine specific hotkeys with backend specific hotkeys.
>
> No, I'm not.  engines/scumm/help.cpp is.  I just extracted the
> list from there.

Oh my god, the help dialog in the SCUMM engine :-). Does anybody even  
maintain that? :-).

[...]

> Well, I haven't even checked the actual docs,
You should, though.

> I'm just comparing the
> on-line help text with what is actually implemented by the code which
> contains it.  As I said, mismatches can be remedied both by removing
> text and by adding implementation, but I don't think it's all that
> clear cut that any mismatches are due to "suckfullness" of the
> documentation.

But it does. Or rather in this case, it documents the "uber- 
suckfullness" / "lameness" of that help dialog. It can't be fixed by  
changing the backends / engines, either -- some backends simply  
*never* will have those hotkeys, ever! So the help dialog *does*  
suck, the issue is orthogonal to whether and how we implement certain  
backend specific hotkeys.

[...]

>> You mean adding those three lines to a couple dozen event loops
>> spread over 11 engines, vs. adding it only in the DC backend (and
>> maybe the X11 backend, should it ever implement aspect ration
>> correction) ? Somehow I fail to see how this is "better" in about any
>> regard... :-)
>
> I'm trying to convince you that having _one_ implementation, and not
> spreading it out _at all_, is better.  Remember?  ;-)

Sure, I do. Do you remember my question? I'll repeat it for you:  
"Marcus, could you give a list of all hotkeys that you think should  
be shared, and state which ports would share them?"

>   Today it's
> three(?) backends which would need the three lines,

It's two backends. From the list you have given so far (i.e.: Ctrl-A.  
And nothing else), your proposal is to add a function which  
essentially does this:
bool handleCommonHotkeys(Event evt) {
   if (hotkey = ctrl-a)
     toggle aspect correction
     return didHandle;
   else
    return didNotHandle;
}

and then modifying those *two* backends to call that function.

> how many tomorrow?

Good question. From where I am at, the best guess I can come up with  
is "likely 0, if not, we can rediscuss this".

> What about the next time such a generic hotkey is added?

Yeah, let's see, in the past 4 years, we added one, we should prepare  
for the second one which is due 2008 :-)


Look, I am all for factoring out shared code when it makes sense, in  
fact a lot of the work I have done in the past years on ScummVM  
revolves around exactly that. But the stress here is on "where it  
makes sense". I think to justify factoring out something, it has to  
be either repeated several times, or has to be complicated. But a  
*trivial* code check, that is used in two places, doesn't quite fill  
that role for me. That's why I ask: Are there other candidates? If we  
have 3-4 hotkeys that are shared by at least 2 backends, we can talk  
this. But it's silly to do that for the single case you have  
suggested so far. To me, it clearly falls into the category "needless  
overdesign".


Cheers,
Max





More information about the Scummvm-devel mailing list