Skip to content

Commit

Permalink
Support reconvert based on surrounding text.
Browse files Browse the repository at this point in the history
  • Loading branch information
ueno committed Dec 27, 2011
1 parent fcb4b23 commit 8ce6480
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/engine.vala
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ class SkkEngine : IBus.Engine {
}); });
update_candidates (); update_candidates ();
update_input_mode (); update_input_mode ();
context.retrieve_surrounding_text.connect (retrieve_surrounding_text);
}

bool retrieve_surrounding_text (out string text, out uint cursor_pos) {
weak IBus.Text _text;
uint _cursor_pos, anchor_pos;
get_surrounding_text (out _text, out _cursor_pos, out anchor_pos);
text = _text.text.dup ();
cursor_pos = _cursor_pos;
return true;
} }


void populate_lookup_table () { void populate_lookup_table () {
Expand Down Expand Up @@ -421,6 +431,11 @@ class SkkEngine : IBus.Engine {


public override void enable () { public override void enable () {
context.reset (); context.reset ();

// request to use surrounding text feature
weak IBus.Text text;
uint cursor_pos, anchor_pos;
get_surrounding_text (null, null, null);
} }


public override void disable () { public override void disable () {
Expand Down
2 changes: 1 addition & 1 deletion src/ibus-1.0.vapi
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace IBus {
public void delete_surrounding_text (int offset, uint nchars); public void delete_surrounding_text (int offset, uint nchars);
public void forward_key_event (uint keyval, uint keycode, uint state); public void forward_key_event (uint keyval, uint keycode, uint state);
public unowned string get_name (); public unowned string get_name ();
public void get_surrounding_text (out unowned IBus.Text text, uint cursor_pos, uint anchor_pos); public void get_surrounding_text (out unowned IBus.Text text, out uint cursor_pos, out uint anchor_pos);
public void hide_auxiliary_text (); public void hide_auxiliary_text ();
public void hide_lookup_table (); public void hide_lookup_table ();
public void hide_preedit_text (); public void hide_preedit_text ();
Expand Down

0 comments on commit 8ce6480

Please sign in to comment.