From: handa Date: Thu, 11 Mar 2010 00:11:17 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: ALPHA~21 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=d05e2866baec1b93a23b651c1a974b238a98f385;p=m17n%2Fm17n-lib-js.git *** empty log message *** --- diff --git a/xex.js b/xex.js index e97c17e..a1d38c0 100644 --- a/xex.js +++ b/xex.js @@ -3138,57 +3138,41 @@ MIM.update = function (target, ic) ic.range[0] += ic.produced.length; ic.range[1] = ic.range[0] + ic.preedit.length; MIM.set_caret (target, ic); + target.wait_update = false; }; MIM.focus_in = function (event) { var target = event.target; var ic = target.mim_ic; - ic.Filter (MIM.Key.FocusIn); - target.removeEventListener (''); - setTimeout (MIM.update (target, ic); - // Ignore further focus-in caused by setSelectionRange (). - target.mim_ignore_focus_in = true; - } - } -} - -MIM.cancel_ignore_focus = function () -{ - if (MIM.focus_ignore_target) + if (target.wait_focus_in); { - MIM.focus_ignore_target.mim_ignore_focus_in = false; - MIM.focus_ignore_target.mim_ignore_focus_out = false; + Xex.Log ("Focus in " + target.tagName + ' IGNORED'); + event.preventDefault (); + return; } + Xex.Log ("Focus in " + target.tagName); + ic.Filter (MIM.Key.FocusIn); + //target.removeEventListener (target, 'focus', MIM.focus_in); + target.wait_update = true; + setTimeout (MIM.update (target, ic), 100); } MIM.focus_out = function (event) { var target = event.target; var ic = target.mim_ic; - if (ic) + if (target.wait_focus_out) { - if (target.mim_ignore_focus_out) - { - Xex.Log ('ignore focus_out in ' + target.tagName); - // Ignore this event which is caused by setSelectionRange (). - target.mim_ignore_focus_out = false; - event.preventDefault (); - } - else - { - Xex.Log ('focus_out in ' + target.tagName); - if (! MIM.get_range (target, ic)) - ic.reset (); - ic.Filter (MIM.Key.FocusOut); - // Ignore further focus-out caused by setSelectionRange (). - target.mim_ignore_focus_in = true; - target.mim_ignore_focus_out = true; - MIM.focus_ignore_target = target; - MIM.update (target, ic); - setTimeout (MIM.cancel_ignore_focus, 100); - } + Xex.Log ("Focus out " + target.tagName + ' IGNORED'); + event.preventDefault (); + return; } + Xex.Log ("Focus out " + target.tagName); + ic.Filter (MIM.Key.FocusOut); + //target.removeEventListener (target, 'blur', MIM.focus_out); + target.wait_update = true; + setTimeout (MIM.update (target, ic), 100); }; MIM.keydown = function (event) @@ -3215,6 +3199,7 @@ MIM.keydown = function (event) } else { + while (target.wait_update); if (! MIM.get_range (target, ic)) ic.reset (); }