Commit feebce3f authored by jamiewalch's avatar jamiewalch Committed by Commit bot

Disable stuck key detection on ChromeOS.

Since we can't rely on the modifier flags on ChromeOS, we can't use them
as a way to detect stuck modifier keys. This means that some actions
(including locking the screen) will result in Ctrl and Shift being stuck,
effectively regressing crbug.com/464534.

BUG=337509,484329

Review URL: https://codereview.chromium.org/1145863002

Cr-Commit-Position: refs/heads/master@{#330899}
parent cb68dc60
...@@ -643,8 +643,8 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { ...@@ -643,8 +643,8 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
VLOG(0) << "Connecting to " << host_jid VLOG(0) << "Connecting to " << host_jid
<< ". Local jid: " << local_jid << "."; << ". Local jid: " << local_jid << ".";
#if defined(OS_NACL)
std::string key_filter; std::string key_filter;
#if defined(OS_NACL)
if (!data.GetString("keyFilter", &key_filter)) { if (!data.GetString("keyFilter", &key_filter)) {
NOTREACHED(); NOTREACHED();
normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_)); normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_));
...@@ -661,12 +661,19 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { ...@@ -661,12 +661,19 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
normalizing_input_filter_.reset(new NormalizingInputFilterMac(&key_mapper_)); normalizing_input_filter_.reset(new NormalizingInputFilterMac(&key_mapper_));
#elif defined(OS_CHROMEOS) #elif defined(OS_CHROMEOS)
key_filter = "cros";
normalizing_input_filter_.reset(new NormalizingInputFilterCros(&key_mapper_)); normalizing_input_filter_.reset(new NormalizingInputFilterCros(&key_mapper_));
#else #else
normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_)); normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_));
#endif #endif
input_handler_.set_input_stub(normalizing_input_filter_.get()); input_handler_.set_input_stub(normalizing_input_filter_.get());
// Enable stuck modifier key detection on platforms other than ChromeOS.
// ChromeOS doesn't set modifier flags for "rewritten" keyboard events
// such as Alt+Backspace, which causes ReleaseAllIfModifiersStuck to
// incorrectly release all keys, so don't enable it on that platform.
input_handler_.set_detect_stuck_modifiers(key_filter != "cros");
// PPB_VideoDecoder is not always enabled because it's broken in some versions // PPB_VideoDecoder is not always enabled because it's broken in some versions
// of Chrome. See crbug.com/447403 . // of Chrome. See crbug.com/447403 .
bool enable_video_decode_renderer = false; bool enable_video_decode_renderer = false;
......
...@@ -118,10 +118,12 @@ PepperInputHandler::PepperInputHandler( ...@@ -118,10 +118,12 @@ PepperInputHandler::PepperInputHandler(
wheel_delta_x_(0), wheel_delta_x_(0),
wheel_delta_y_(0), wheel_delta_y_(0),
wheel_ticks_x_(0), wheel_ticks_x_(0),
wheel_ticks_y_(0) { wheel_ticks_y_(0),
detect_stuck_modifiers_(false) {
} }
bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) { bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) {
if (detect_stuck_modifiers_)
ReleaseAllIfModifiersStuck(event); ReleaseAllIfModifiersStuck(event);
switch (event.GetType()) { switch (event.GetType()) {
......
...@@ -40,6 +40,11 @@ class PepperInputHandler { ...@@ -40,6 +40,11 @@ class PepperInputHandler {
send_mouse_move_deltas_ = enable; send_mouse_move_deltas_ = enable;
} }
// Enable or disable detection of stuck modifier keys.
void set_detect_stuck_modifiers(bool detect) {
detect_stuck_modifiers_ = detect;
}
// Processes PPAPI events and dispatches them to |input_stub_|. // Processes PPAPI events and dispatches them to |input_stub_|.
bool HandleInputEvent(const pp::InputEvent& event); bool HandleInputEvent(const pp::InputEvent& event);
...@@ -76,6 +81,9 @@ class PepperInputHandler { ...@@ -76,6 +81,9 @@ class PepperInputHandler {
float wheel_ticks_x_; float wheel_ticks_x_;
float wheel_ticks_y_; float wheel_ticks_y_;
// Whether or not to check for stuck modifier keys on keyboard input events.
bool detect_stuck_modifiers_;
DISALLOW_COPY_AND_ASSIGN(PepperInputHandler); DISALLOW_COPY_AND_ASSIGN(PepperInputHandler);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment