diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-22 21:40:39 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-22 21:40:39 +0000 |
commit | 9f2fe26adbb1682d3f0566beeb31721b7f4e3a84 (patch) | |
tree | 9dca03469c292d2c652aecac4aa3d862d4258718 /remoting | |
parent | fff8e6f15c42b509dcd3966976c03d69fd53593b (diff) | |
download | chromium_src-9f2fe26adbb1682d3f0566beeb31721b7f4e3a84.zip chromium_src-9f2fe26adbb1682d3f0566beeb31721b7f4e3a84.tar.gz chromium_src-9f2fe26adbb1682d3f0566beeb31721b7f4e3a84.tar.bz2 |
Allow mouse-input to be enabled even if the plugin does not have keyboard focus.
BUG=376070
Review URL: https://codereview.chromium.org/296943003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 6 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.h | 1 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_input_handler.cc | 7 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_input_handler.h | 10 |
4 files changed, 21 insertions, 3 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 83c25cb..100004d 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -360,6 +360,8 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) { HandleAllowMouseLockMessage(); } else if (method == "enableMediaSourceRendering") { HandleEnableMediaSourceRendering(); + } else if (method == "sendMouseInputWhenUnfocused") { + HandleSendMouseInputWhenUnfocused(); } } @@ -964,6 +966,10 @@ void ChromotingInstance::HandleEnableMediaSourceRendering() { use_media_source_rendering_ = true; } +void ChromotingInstance::HandleSendMouseInputWhenUnfocused() { + input_handler_.set_send_mouse_input_when_unfocused(true); +} + ChromotingStats* ChromotingInstance::GetStats() { if (!video_renderer_.get()) return NULL; diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index 2843c97..840a8f7 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -209,6 +209,7 @@ class ChromotingInstance : void HandleExtensionMessage(const base::DictionaryValue& data); void HandleAllowMouseLockMessage(); void HandleEnableMediaSourceRendering(); + void HandleSendMouseInputWhenUnfocused(); // Helper method called from Connect() to connect with parsed config. void ConnectWithConfig(const ClientConfig& config, diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc index b9ec4e8..5bdebf3 100644 --- a/remoting/client/plugin/pepper_input_handler.cc +++ b/remoting/client/plugin/pepper_input_handler.cc @@ -23,6 +23,7 @@ PepperInputHandler::PepperInputHandler( input_stub_(NULL), callback_factory_(this), has_focus_(false), + send_mouse_input_when_unfocused_(false), mouse_lock_state_(MouseLockDisallowed), wheel_delta_x_(0), wheel_delta_y_(0), @@ -74,7 +75,7 @@ bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { case PP_INPUTEVENT_TYPE_MOUSEDOWN: case PP_INPUTEVENT_TYPE_MOUSEUP: { - if (!has_focus_) + if (!has_focus_ && !send_mouse_input_when_unfocused_) return false; pp::MouseInputEvent pp_mouse_event(event); @@ -114,7 +115,7 @@ 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_) + if (!has_focus_ && !send_mouse_input_when_unfocused_) return false; pp::MouseInputEvent pp_mouse_event(event); @@ -135,7 +136,7 @@ bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { } case PP_INPUTEVENT_TYPE_WHEEL: { - if (!has_focus_) + if (!has_focus_ && !send_mouse_input_when_unfocused_) return false; pp::WheelInputEvent pp_wheel_event(event); diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h index d975670..9ec0475 100644 --- a/remoting/client/plugin/pepper_input_handler.h +++ b/remoting/client/plugin/pepper_input_handler.h @@ -48,6 +48,12 @@ class PepperInputHandler : public pp::MouseLock { void SetMouseCursor(scoped_ptr<pp::ImageData> image, const pp::Point& hotspot); + // Enable or disable sending mouse input when the plugin does not have input + // focus. + void set_send_mouse_input_when_unfocused(bool send) { + send_mouse_input_when_unfocused_ = send; + } + private: enum MouseLockState { MouseLockDisallowed, @@ -90,6 +96,10 @@ class PepperInputHandler : public pp::MouseLock { // True if the plugin has focus. bool has_focus_; + // True if the plugin should respond to mouse input even if it does not have + // keyboard focus. + bool send_mouse_input_when_unfocused_; + MouseLockState mouse_lock_state_; // Accumulated sub-pixel and sub-tick deltas from wheel events. |