Personal tools

Talk:WebAPI/KeboardIME

From MozillaWiki

Jump to: navigation, search

Contents

Erratum

When it is said: "[Line 9-30] a "entry_points" field specifies supported layouts."

Maybe it's not "entry_points", maybe it is referring to the "inputs" field.

Proposed API (July 17 WIP)

mozInputMethod API to Keyboard Apps

partial interface Navigator {
    readonly attribute nsIDOMInputMethod mozInputMethod;
};
interface nsIDOMInputMethod: nsIDOMEventTarget {
    // Input Method Manager contain a few global methods expose to apps
    readonly attribute nsIDOMInputMethodManager mgmt;

    // An "input context" is mapped to a text field that the app is allow to mutate.
    // this attribute should be null when there is no text field currently focused.
    attribute nsIDOMInputContext|null inputcontext;

    // Fired when the input context changes, include changes from and to null.
    attribute nsIDOMEventListener oninputcontextchange;
};
interface nsIDOMInputMethodManager {
   // Ask the OS to switch away from the current active Keyboard app.
   // OS should ignore this request if we are currently not the active one.
   void next();

   // Ask the OS to show a list of available IMEs for users to switch from.
   // OS should ignore this request if we are currently not the active one.
   void showAll();
};
interface nsIDOMInputContext {
   // an "input context" gets void when the app is no longer allowed to interact with the text field,
   // e.g., the text field is no longer exists, the app is being switched to background, etc.

   // All the properties and methods necessary to work with a specific text field should be here.
   ....
}

mozChromeEvents to System apps

Here are some signals necessary to Keyboard Manager in System app in order for it to do minimal interaction with keyboard app and text field.

  • inputmethod-contextchange: should also expose the nsIDOMInputContext object here
  • inputmethod-next
  • inputmethod-showall

mozbrowser API extension

  • setInputMethodActive(boolean): Depend on what we want, we might not want to re-use setVisible() to block/unblock a background/foreground keyboard app to interact with the text fields.