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) {
VLOG(0) << "Connecting to " << host_jid
<< ". Local jid: " << local_jid << ".";
#if defined(OS_NACL)
std::string key_filter;
#if defined(OS_NACL)
if (!data.GetString("keyFilter", &key_filter)) {
NOTREACHED();
normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_));
......@@ -661,12 +661,19 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
#elif defined(OS_MACOSX)
normalizing_input_filter_.reset(new NormalizingInputFilterMac(&key_mapper_));
#elif defined(OS_CHROMEOS)
key_filter = "cros";
normalizing_input_filter_.reset(new NormalizingInputFilterCros(&key_mapper_));
#else
normalizing_input_filter_.reset(new protocol::InputFilter(&key_mapper_));
#endif
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
// of Chrome. See crbug.com/447403 .
bool enable_video_decode_renderer = false;
......
......@@ -118,11 +118,13 @@ PepperInputHandler::PepperInputHandler(
wheel_delta_x_(0),
wheel_delta_y_(0),
wheel_ticks_x_(0),
wheel_ticks_y_(0) {
wheel_ticks_y_(0),
detect_stuck_modifiers_(false) {
}
bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) {
ReleaseAllIfModifiersStuck(event);
if (detect_stuck_modifiers_)
ReleaseAllIfModifiersStuck(event);
switch (event.GetType()) {
// Touch input cases.
......
......@@ -40,6 +40,11 @@ class PepperInputHandler {
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_|.
bool HandleInputEvent(const pp::InputEvent& event);
......@@ -76,6 +81,9 @@ class PepperInputHandler {
float wheel_ticks_x_;
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);
};
......
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