OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/sticky_keys.h" | 5 #include "ash/wm/sticky_keys.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #undef RootWindow | 10 #undef RootWindow |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return event->type() == ui::ET_KEY_PRESSED ? | 262 return event->type() == ui::ET_KEY_PRESSED ? |
263 OTHER_MODIFIER_DOWN : OTHER_MODIFIER_UP; | 263 OTHER_MODIFIER_DOWN : OTHER_MODIFIER_UP; |
264 } | 264 } |
265 | 265 |
266 bool StickyKeysHandler::HandleDisabledState(ui::KeyEvent* event) { | 266 bool StickyKeysHandler::HandleDisabledState(ui::KeyEvent* event) { |
267 switch (TranslateKeyEvent(event)) { | 267 switch (TranslateKeyEvent(event)) { |
268 case TARGET_MODIFIER_UP: | 268 case TARGET_MODIFIER_UP: |
269 if (preparing_to_enable_) { | 269 if (preparing_to_enable_) { |
270 preparing_to_enable_ = false; | 270 preparing_to_enable_ = false; |
271 current_state_ = ENABLED; | 271 current_state_ = ENABLED; |
272 modifier_up_event_.reset(event->Copy()); | 272 modifier_up_event_.reset(new ui::KeyEvent(*event)); |
273 return true; | 273 return true; |
274 } | 274 } |
275 return false; | 275 return false; |
276 case TARGET_MODIFIER_DOWN: | 276 case TARGET_MODIFIER_DOWN: |
277 preparing_to_enable_ = true; | 277 preparing_to_enable_ = true; |
278 return false; | 278 return false; |
279 case NORMAL_KEY_DOWN: | 279 case NORMAL_KEY_DOWN: |
280 preparing_to_enable_ = false; | 280 preparing_to_enable_ = false; |
281 return false; | 281 return false; |
282 case NORMAL_KEY_UP: | 282 case NORMAL_KEY_UP: |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 &xievent->mods.effective)); | 418 &xievent->mods.effective)); |
419 } | 419 } |
420 } | 420 } |
421 #elif defined(USE_OZONE) | 421 #elif defined(USE_OZONE) |
422 NOTIMPLEMENTED() << "Modifier key is not handled"; | 422 NOTIMPLEMENTED() << "Modifier key is not handled"; |
423 #endif | 423 #endif |
424 event->set_flags(event->flags() | modifier_flag_); | 424 event->set_flags(event->flags() | modifier_flag_); |
425 } | 425 } |
426 | 426 |
427 } // namespace ash | 427 } // namespace ash |
OLD | NEW |