diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-06 05:44:08 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-06 05:44:08 +0000 |
commit | cb56f0d147cced82cb266dd1fde0f47240f22adf (patch) | |
tree | 4e2624f5abf5840e7b5eedec32a97f9e2187bb96 /remoting | |
parent | c178a234601bc745351061294b9a66690cc9d2cb (diff) | |
download | chromium_src-cb56f0d147cced82cb266dd1fde0f47240f22adf.zip chromium_src-cb56f0d147cced82cb266dd1fde0f47240f22adf.tar.gz chromium_src-cb56f0d147cced82cb266dd1fde0f47240f22adf.tar.bz2 |
Don't send mouse events if the plugin doesn't have focus.
This works around http://crbug.com/246335 and reinstates the fix for http://crbug.com/236549.
BUG=236549
Review URL: https://codereview.chromium.org/136093013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/plugin/pepper_input_handler.cc | 9 | ||||
-rw-r--r-- | remoting/webapp/client_session.js | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc index 9069f1a..60a2746 100644 --- a/remoting/client/plugin/pepper_input_handler.cc +++ b/remoting/client/plugin/pepper_input_handler.cc @@ -75,6 +75,9 @@ bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { case PP_INPUTEVENT_TYPE_MOUSEDOWN: case PP_INPUTEVENT_TYPE_MOUSEUP: { + if (!has_focus_) + return false; + pp::MouseInputEvent pp_mouse_event(event); protocol::MouseEvent mouse_event; switch (pp_mouse_event.GetButton()) { @@ -111,6 +114,9 @@ bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { case PP_INPUTEVENT_TYPE_MOUSEMOVE: case PP_INPUTEVENT_TYPE_MOUSEENTER: case PP_INPUTEVENT_TYPE_MOUSELEAVE: { + if (!has_focus_) + return false; + pp::MouseInputEvent pp_mouse_event(event); protocol::MouseEvent mouse_event; mouse_event.set_x(pp_mouse_event.GetPosition().x()); @@ -128,6 +134,9 @@ bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { } case PP_INPUTEVENT_TYPE_WHEEL: { + if (!has_focus_) + return false; + pp::WheelInputEvent pp_wheel_event(event); // Don't handle scroll-by-page events, for now. diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js index 8a63998..7b0d80e 100644 --- a/remoting/webapp/client_session.js +++ b/remoting/webapp/client_session.js @@ -388,7 +388,11 @@ remoting.ClientSession.prototype.pluginLostFocus_ = function() { this.plugin_.releaseAllKeys(); if (this.plugin_.element()) { // Focus should stay on the element, not (for example) the toolbar. - this.plugin_.element().focus(); + // Due to crbug.com/246335, we can't restore the focus immediately, + // otherwise the plugin gets confused about whether or not it has focus. + window.setTimeout( + this.plugin_.element().focus.bind(this.plugin_.element()), + 0); } } }; |