mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Standardize IME callbacks for off-screen rendering (issue #1675)
This commit is contained in:
@ -618,24 +618,62 @@ typedef struct _cef_browser_host_t {
|
||||
struct _cef_browser_host_t* self, int frame_rate);
|
||||
|
||||
///
|
||||
// Get the NSTextInputContext implementation for enabling IME on Mac when
|
||||
// window rendering is disabled.
|
||||
// Begins a new composition or updates the existing composition. Blink has a
|
||||
// special node (a composition node) that allows the input function to change
|
||||
// text without affecting other DOM nodes. |text| is the optional text that
|
||||
// will be inserted into the composition node. |underlines| is an optional set
|
||||
// of ranges that will be underlined in the resulting text.
|
||||
// |replacement_range| is an optional range of the existing text that will be
|
||||
// replaced. |selection_range| is an optional range of the resulting text that
|
||||
// will be selected after insertion or replacement. The |replacement_range|
|
||||
// value is only used on OS X.
|
||||
//
|
||||
// This function may be called multiple times as the composition changes. When
|
||||
// the client is done making changes the composition should either be canceled
|
||||
// or completed. To cancel the composition call ImeCancelComposition. To
|
||||
// complete the composition call either ImeCommitText or
|
||||
// ImeFinishComposingText. Completion is usually signaled when:
|
||||
// A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR
|
||||
// flag (on Windows), or;
|
||||
// B. The client receives a "commit" signal of GtkIMContext (on Linux), or;
|
||||
// C. insertText of NSTextInput is called (on Mac).
|
||||
//
|
||||
// This function is only used when window rendering is disabled.
|
||||
///
|
||||
cef_text_input_context_t (CEF_CALLBACK *get_nstext_input_context)(
|
||||
struct _cef_browser_host_t* self);
|
||||
void (CEF_CALLBACK *ime_set_composition)(struct _cef_browser_host_t* self,
|
||||
const cef_string_t* text, size_t underlinesCount,
|
||||
cef_composition_underline_t const* underlines,
|
||||
const cef_range_t* replacement_range,
|
||||
const cef_range_t* selection_range);
|
||||
|
||||
///
|
||||
// Handles a keyDown event prior to passing it through the NSTextInputClient
|
||||
// machinery.
|
||||
// Completes the existing composition by optionally inserting the specified
|
||||
// |text| into the composition node. |replacement_range| is an optional range
|
||||
// of the existing text that will be replaced. |relative_cursor_pos| is where
|
||||
// the cursor will be positioned relative to the current cursor position. See
|
||||
// comments on ImeSetComposition for usage. The |replacement_range| and
|
||||
// |relative_cursor_pos| values are only used on OS X. This function is only
|
||||
// used when window rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *handle_key_event_before_text_input_client)(
|
||||
struct _cef_browser_host_t* self, cef_event_handle_t keyEvent);
|
||||
void (CEF_CALLBACK *ime_commit_text)(struct _cef_browser_host_t* self,
|
||||
const cef_string_t* text, const cef_range_t* replacement_range,
|
||||
int relative_cursor_pos);
|
||||
|
||||
///
|
||||
// Performs any additional actions after NSTextInputClient handles the event.
|
||||
// Completes the existing composition by applying the current composition node
|
||||
// contents. If |keep_selection| is false (0) the current selection, if any,
|
||||
// will be discarded. See comments on ImeSetComposition for usage. This
|
||||
// function is only used when window rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *handle_key_event_after_text_input_client)(
|
||||
struct _cef_browser_host_t* self, cef_event_handle_t keyEvent);
|
||||
void (CEF_CALLBACK *ime_finish_composing_text)(
|
||||
struct _cef_browser_host_t* self, int keep_selection);
|
||||
|
||||
///
|
||||
// Cancels the existing composition and discards the composition node contents
|
||||
// without applying them. See comments on ImeSetComposition for usage. This
|
||||
// function is only used when window rendering is disabled.
|
||||
///
|
||||
void (CEF_CALLBACK *ime_cancel_composition)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Call this function when the user drags the mouse into the web view (before
|
||||
|
@ -161,6 +161,16 @@ typedef struct _cef_render_handler_t {
|
||||
void (CEF_CALLBACK *on_scroll_offset_changed)(
|
||||
struct _cef_render_handler_t* self, struct _cef_browser_t* browser,
|
||||
double x, double y);
|
||||
|
||||
///
|
||||
// Called when the IME composition range has changed. |selected_range| is the
|
||||
// range of characters that have been selected. |character_bounds| is the
|
||||
// bounds of each character in view coordinates.
|
||||
///
|
||||
void (CEF_CALLBACK *on_ime_composition_range_changed)(
|
||||
struct _cef_render_handler_t* self, struct _cef_browser_t* browser,
|
||||
const cef_range_t* selected_range, size_t character_boundsCount,
|
||||
cef_rect_t const* character_bounds);
|
||||
} cef_render_handler_t;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user