OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/base/win/ime_input.h" | 5 #include "ui/base/win/ime_input.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 if (keystate[VK_RSHIFT] & kKeyDownMask) { | 534 if (keystate[VK_RSHIFT] & kKeyDownMask) { |
535 keystate[VK_RSHIFT] = 0; | 535 keystate[VK_RSHIFT] = 0; |
536 *direction = base::i18n::RIGHT_TO_LEFT; | 536 *direction = base::i18n::RIGHT_TO_LEFT; |
537 } else if (keystate[VK_LSHIFT] & kKeyDownMask) { | 537 } else if (keystate[VK_LSHIFT] & kKeyDownMask) { |
538 keystate[VK_LSHIFT] = 0; | 538 keystate[VK_LSHIFT] = 0; |
539 *direction = base::i18n::LEFT_TO_RIGHT; | 539 *direction = base::i18n::LEFT_TO_RIGHT; |
540 } else { | 540 } else { |
541 return false; | 541 return false; |
542 } | 542 } |
543 | 543 |
544 // Scan the key status to find pressed keys. We should adandon changing the | 544 // Scan the key status to find pressed keys. We should abandon changing the |
545 // text direction when there are other pressed keys. | 545 // text direction when there are other pressed keys. |
546 // This code is executed only when a user is pressing a control key and a | 546 // This code is executed only when a user is pressing a control key and a |
547 // right-shift key (or a left-shift key), i.e. we should ignore the status of | 547 // right-shift key (or a left-shift key), i.e. we should ignore the status of |
548 // the keys: VK_SHIFT, VK_CONTROL, VK_RCONTROL, and VK_LCONTROL. | 548 // the keys: VK_SHIFT, VK_CONTROL, VK_RCONTROL, and VK_LCONTROL. |
549 // So, we reset their status to 0 and ignore them. | 549 // So, we reset their status to 0 and ignore them. |
550 keystate[VK_SHIFT] = 0; | 550 keystate[VK_SHIFT] = 0; |
551 keystate[VK_CONTROL] = 0; | 551 keystate[VK_CONTROL] = 0; |
552 keystate[VK_RCONTROL] = 0; | 552 keystate[VK_RCONTROL] = 0; |
553 keystate[VK_LCONTROL] = 0; | 553 keystate[VK_LCONTROL] = 0; |
554 for (int i = 0; i <= VK_PACKET; ++i) { | 554 for (int i = 0; i <= VK_PACKET; ++i) { |
555 if (keystate[i] & kKeyDownMask) | 555 if (keystate[i] & kKeyDownMask) |
556 return false; | 556 return false; |
557 } | 557 } |
558 return true; | 558 return true; |
559 } | 559 } |
560 | 560 |
561 } // namespace ui | 561 } // namespace ui |
OLD | NEW |