| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/events/event_rewriter.h" | 5 #include "chrome/browser/chromeos/events/event_rewriter.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/sticky_keys/sticky_keys_controller.h" | 9 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 void EventRewriter::RewriteLocatedEvent(const ui::Event& event, | 891 void EventRewriter::RewriteLocatedEvent(const ui::Event& event, |
| 892 int* flags) { | 892 int* flags) { |
| 893 const PrefService* pref_service = GetPrefService(); | 893 const PrefService* pref_service = GetPrefService(); |
| 894 if (!pref_service) | 894 if (!pref_service) |
| 895 return; | 895 return; |
| 896 *flags = GetRemappedModifierMasks(*pref_service, event, *flags); | 896 *flags = GetRemappedModifierMasks(*pref_service, event, *flags); |
| 897 } | 897 } |
| 898 | 898 |
| 899 int EventRewriter::RewriteModifierClick(const ui::MouseEvent& mouse_event, | 899 int EventRewriter::RewriteModifierClick(const ui::MouseEvent& mouse_event, |
| 900 int* flags) { | 900 int* flags) { |
| 901 // Remap Search+Button1 to Button3. | 901 // Remap Alt+Button1 to Button3. |
| 902 const int kSearchLeftButton = | 902 const int kAltLeftButton = (ui::EF_ALT_DOWN | ui::EF_LEFT_MOUSE_BUTTON); |
| 903 (ui::EF_COMMAND_DOWN | ui::EF_LEFT_MOUSE_BUTTON); | 903 if (((*flags & kAltLeftButton) == kAltLeftButton) && |
| 904 if (((*flags & kSearchLeftButton) == kSearchLeftButton) && | |
| 905 ((mouse_event.type() == ui::ET_MOUSE_PRESSED) || | 904 ((mouse_event.type() == ui::ET_MOUSE_PRESSED) || |
| 906 pressed_device_ids_.count(mouse_event.source_device_id()))) { | 905 pressed_device_ids_.count(mouse_event.source_device_id()))) { |
| 907 *flags &= ~kSearchLeftButton; | 906 *flags &= ~kAltLeftButton; |
| 908 *flags |= ui::EF_RIGHT_MOUSE_BUTTON; | 907 *flags |= ui::EF_RIGHT_MOUSE_BUTTON; |
| 909 if (mouse_event.type() == ui::ET_MOUSE_PRESSED) | 908 if (mouse_event.type() == ui::ET_MOUSE_PRESSED) |
| 910 pressed_device_ids_.insert(mouse_event.source_device_id()); | 909 pressed_device_ids_.insert(mouse_event.source_device_id()); |
| 911 else | 910 else |
| 912 pressed_device_ids_.erase(mouse_event.source_device_id()); | 911 pressed_device_ids_.erase(mouse_event.source_device_id()); |
| 913 return ui::EF_RIGHT_MOUSE_BUTTON; | 912 return ui::EF_RIGHT_MOUSE_BUTTON; |
| 914 } | 913 } |
| 915 return ui::EF_NONE; | 914 return ui::EF_NONE; |
| 916 } | 915 } |
| 917 | 916 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 948 for (const auto& keyboard : keyboards) { | 947 for (const auto& keyboard : keyboards) { |
| 949 if (keyboard.id == device_id) { | 948 if (keyboard.id == device_id) { |
| 950 return KeyboardDeviceAddedInternal( | 949 return KeyboardDeviceAddedInternal( |
| 951 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); | 950 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); |
| 952 } | 951 } |
| 953 } | 952 } |
| 954 return kDeviceUnknown; | 953 return kDeviceUnknown; |
| 955 } | 954 } |
| 956 | 955 |
| 957 } // namespace chromeos | 956 } // namespace chromeos |
| OLD | NEW |