Chris Laurel wrote:
> I'm preparing a big list of Celestia bugs and work items, compiled from
> Paolo's Celestia features pages, my own ideas, and suggestions from this
> list and the forums. Definite things for 1.3.2 are Pat's Gtk 2.0 UI,
> extended character set support, and proper occluding of the labels (a NASA
I have got a couple of changes for lua-scripting, but right now I will
only write about one to limit the length of this mail: Keyboard input
for scripts. This would be a useful feature, but it requires some help
in other parts of celestia. I would like to know what you think about
this, or if there are some problems I failed to see. I got a quick
implementation working here, which I believe could be integrated after
Scripts can request keyboard via "celestia:requestkeyboard(true)".
This sets a flag in CelestiaCore (I changed the type of textEnterMode to
int and added an enum with three flags: KbDirect, KbAutoComplete,
KbPassToCelx). As long as textEnterMode == KbPassToCelx, each keypress
reaching CelestiaCore::charEntered will be passed on to a running script
via a new method LuaState::charEntered, which tries to call a
lua-function with a fixed name, the keyboard-handler of the script.
One problem with this: not all keypresses reach
CelestiaCore::charEntered, notably not on KDE (because active
keyboard-shortcuts intercept some), I am not sure about other platforms.
To solve this I used "notifyWatchers" with a new flag
"TextEnterModeChanged" and added some code for KDE which disables (or
enables) the shortcuts when being notified and depending on textEnterMode.
There are some open questions:
which keys should be passed on? I favor all except Escape (to terminate
the script), but I assume the keycodes vary with platform.
Can a script decide to not handle a specific key, for example by
returning false in the handler to signal celestia that it should
continue and process this key? Or even more general: Should a script be
allowed to "send" keypresses to celestia?