From 5df28554acb998b7df686122bb26cb897e40e075 Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Sun, 3 Jun 2007 18:44:03 +0000 Subject: [PATCH] Adding the new kFeatureDisableKeyFiltering OSystem feature. This feature is used by agi's prediction dialog and is a hint to the backend to temporarily switch off any keyboard mapping, used in devices with limited keyboard input. Also, supply some comments to the newly added event & feature. svn-id: r27069 --- common/events.h | 6 ++++++ common/system.h | 19 +++++++++++++++++-- engines/agi/predictive.cpp | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/common/events.h b/common/events.h index 9b434e94f95..ac12fd3f4c1 100644 --- a/common/events.h +++ b/common/events.h @@ -57,6 +57,12 @@ enum EventType { EVENT_QUIT = 10, EVENT_SCREEN_CHANGED = 11, + /** The backend requests the agi engine's predictive dialog to be shown. + * TODO: Fingolfin suggests that it would be of better value to expand + * on this notion by generalizing its use. For example the backend could + * use events to ask for the save game dialog or to pause the engine. + * An associated enumerated type can accomplish this. + **/ EVENT_PREDICTIVE_DIALOG = 12 }; diff --git a/common/system.h b/common/system.h index ccca1fb7c75..500056e695c 100644 --- a/common/system.h +++ b/common/system.h @@ -125,7 +125,7 @@ public: kFeatureAutoComputeDirtyRects, /** - * This flags determines either cursor can have its own palette or not + * This flag determines either cursor can have its own palette or not * It is currently used only by some Macintosh versions of Humongous * Entertainment games. If backend doesn't implement this feature then * engine switches to b/w version of cursors. @@ -142,7 +142,22 @@ public: /** * Set to true to iconify the window. */ - kFeatureIconifyWindow + kFeatureIconifyWindow, + + /** + * This feature, set to true, is a hint toward the backend to disable all + * key filtering/mapping, in cases where it would be beneficial to do so. + * As an example case, this is used in the agi engine's predictive dialog. + * When the dialog is displayed this feature is set so that backends with + * phone-like keypad temporarily unmap all user actions which leads to + * comfortable word entry. Conversely, when the dialog exits the feature + * is set to false. + * TODO: Fingolfin suggests that the way the feature is used can be + * generalized in this sense: Have a keyboard mapping feature, which the + * engine queries for to assign keys to actions ("Here's my default key + * map for these actions, what do you want them set to?"). + */ + kFeatureDisableKeyFiltering }; /** diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index e3f38463ac0..230c15de589 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -120,6 +120,7 @@ bool AgiEngine::predictiveDialog(void) { AgiBlock tmpwindow; _predictiveDialogRunning = true; + _system->setFeatureState(OSystem::kFeatureDisableKeyFiltering, true); // FIXME: Move this to a more appropriate place. initAsciiToNumTable(); @@ -405,6 +406,7 @@ processkey: _gfx->doUpdate(); } + _system->setFeatureState(OSystem::kFeatureDisableKeyFiltering, false); _predictiveDialogRunning = false; return rc;