Chromium Code Reviews| Index: ppapi/c/ppb_input_event.h |
| diff --git a/ppapi/c/ppb_input_event.h b/ppapi/c/ppb_input_event.h |
| index 8a73279e4ebc51591764733afdd94b3da838d0f6..113135ba560e302a69f5195f0c123fd356508638 100644 |
| --- a/ppapi/c/ppb_input_event.h |
| +++ b/ppapi/c/ppb_input_event.h |
| @@ -31,6 +31,10 @@ |
| #define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ |
| PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 |
| +#define PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_0 "PPB_CompositionInputEvent;1.0" |
| +#define PPB_COMPOSITION_INPUT_EVENT_INTERFACE \ |
| + PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_0 |
| + |
| /** |
| * @file |
| * This file defines the Input Event interfaces. |
| @@ -117,7 +121,31 @@ typedef enum { |
| * |
| * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. |
| */ |
| - PP_INPUTEVENT_TYPE_CONTEXTMENU = 10 |
| + PP_INPUTEVENT_TYPE_CONTEXTMENU = 10, |
| + /** |
| + * Notification that an input method composition process has just started. |
| + * |
| + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. |
| + */ |
| + PP_INPUTEVENT_TYPE_COMPOSITION_START = 11, |
| + /** |
| + * Notification that the input method composition string is updated. |
| + * |
| + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. |
| + */ |
| + PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE = 12, |
| + /** |
| + * Notification that an input method composition process has completed. |
| + * |
| + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. |
| + */ |
| + PP_INPUTEVENT_TYPE_COMPOSITION_END = 13, |
| + /** |
| + * Notification that an input method committed a string. |
| + * |
| + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. |
| + */ |
| + PP_INPUTEVENT_TYPE_IME_TEXT = 14 |
| } PP_InputEvent_Type; |
| PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); |
| @@ -674,6 +702,62 @@ struct PPB_KeyboardInputEvent { |
| */ |
| struct PP_Var (*GetCharacterText)(PP_Resource character_event); |
| }; |
| + |
| +/** |
| + * The <code>PPB_CompositionInputEvent</code> interface contains pointers to |
| + * several functions related to composition input events. |
| + */ |
| +#define PPB_COMPOSITION_INPUT_EVENT_INTERFACE \ |
| + PPB_COMPOSITION_INPUT_EVENT_INTERFACE_1_0 |
| + |
| +struct PPB_CompositionInputEvent { |
| + /** |
| + * IsCompositionInputEvent() determines if a resource is a composition event. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> corresponding to an event. |
| + * |
| + * @return <code>PP_TRUE</code> if the given resource is a valid input event. |
| + */ |
| + PP_Bool (*IsCompositionInputEvent)(PP_Resource resource); |
| + /** |
| + * GetText() returns the composition text as a UTF-8 string for the given |
| + * composition event. |
| + * |
| + * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| + * composition event. |
| + * |
| + * @return A string var representing the composition text. For non-composition |
| + * input events the return value will be an undefined var. |
| + */ |
| + struct PP_Var (*GetText)(PP_Resource composition_event); |
| + /** |
| + * GetTargetSegment() returns the index in the array retrieved by GetSegments |
| + * indicating the segment currently under composition. |
| + * |
| + * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| + * composition event. |
| + * |
| + * @return An integer indicating the index of the target segment. |
| + * For events other than COMPOSITION_UPDATE, returns 0. |
| + */ |
| + uint32_t (*GetTargetSegment)(PP_Resource composition_event); |
|
kochi
2011/09/09 07:58:59
Could you change this to GetSelectionRange()?
prob
|
| + /** |
| + * GetSegments() returns the segmentation information by a list of indices of |
| + * a UTF-8 string returned by GetText. For events other than |
| + * COMPOSITION_UPDATE, it does nothing. |
| + * |
| + * @param[in] composition_event A <code>PP_Resource</code> corresponding to a |
| + * composition event. |
| + * |
| + * @param[out] segments A pointer to an array containing the list of indices |
| + * of the segmentation. |
| + * |
| + * @param[out] segments The length of the array <code>segments</code>. |
| + */ |
| + void (*GetSegments)(PP_Resource composition_event, |
| + uint32_t** segments, |
| + uint32_t* size); |
| +}; |
| /** |
| * @} |
| */ |