[Scummvm-devel] Simplifying keyboard repeat
Max Horn
max at quendi.de
Fri May 19 00:54:08 CEST 2006
Am 16.05.2006 um 19:36 schrieb Marcus Comstedt:
>
> "Max Horn" <max at quendi.de> writes:
>
>> But this shortcut is highly platform dependant, isn't it? Most of our
>> targets (including the Dreamcast, I believe?) don't even have a
>> ctrl or an
>> A key.
>
> All Dreamcast keyboards (the Japanese one, the US one, and the
> European one)
Ah, I didn't know such a thing existed.
> have both a Ctrl key (two actually), and an A key.
> If you press them together, an Event with kbd.flags == KBD_CTRL and
> kbd.keycode == kbd.ascii == 'a' will be generated. What's platform
> dependent about that?
Again, I didn't know the DC had keyboards, I generally don't
associate game consoles with keyboards in my mind :-). But that's why
I worded my original mail quite carefully in this regard (formulating
a question about this, even!), I hope you agree when you re-read it.
> Sure, not everyone has a keyboard for their
> Dreamcast, but so what? How will those people be helped by having the
> ctrl-a code duplicated in backends/sdl and backends/dc instead of in a
> central place?
Calm down :-).
So keyboard access is available at least for the DC, some SDL ports,
and the X11 port.
The original question on this thread was keyboard repeat.
Implementing keyboard repeat in a platform independent way is what
the GUI code currently tries to do, with mixed success. As David
Given pointed out, this may cause problems on e.g. X11.
So, the natural way to handle this is to use the native keyboard
repeat when available, and to emulate it otherwise. To this end, we
could either add a kFeatureKeyboardRepeat flag. Or, we could
*require* backends to implement/emulate keyboard repeat, but provide
the code required for that. Maybe it would even be possible to add
the code require for that directly into OSystem, thus letting porters
implement this with a minimal amount of work.
The latter approach has the nice benefit that it would require the
least changes to client code. With the former, we'd have to change
all event loops to use some kind of new encapsulation API.
Now, the other topic Marcus brought up are keyboard shortcuts. Well,
I am not convinced that "sharing" code there is that useful. I just
wrote a looong three paragraphs about it, but now decided to delete
them, and instead ask this: Marcus, could you give a list of all
hotkeys that you think should be shared, and state which ports would
share them? So far, after looking through all backends, the only
example I could come up with what precisely yours: Ctrl-A seems
useful for both SDL and DC (and *maybe* PalmOS).
Convince me that adding a whole generic hotkey sharing infrastructure
would save us more work than adding three lines to the DC backend to
implement Ctrl-A, and we can discuss it for real :-).
Cheers,
Max
More information about the Scummvm-devel
mailing list