/// <summary> /// If Browser control dosesn't have X11 input focus. /// then Ensure that it does.. /// </summary> protected void EnsureFocusedGeckoControlHasInputFocus() { if ((_browser == null) || (_browser.HasInputFocus())) { return; } // Attempt ot do it right away. this._browser.SetInputFocus(); // Othewise do it on the first idle event. Action setInputFocus = null; setInputFocus = () => { ProgressUtils.InvokeLaterOnIdle(() => { if (_browser == null) { return; } if (Form.ActiveForm == null || _browser.ContainsFocus == false) { MoveInputFocusBacktoAWinFormsControl(); return; } if (!_browser.HasInputFocus()) { this._browser.SetInputFocus(); } if (!_browser.HasInputFocus()) { setInputFocus(); } }, null); }; setInputFocus(); }