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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 void EventRewriter::RewriteLocatedEvent(const ui::Event& event, | 883 void EventRewriter::RewriteLocatedEvent(const ui::Event& event, |
884 int* flags) { | 884 int* flags) { |
885 const PrefService* pref_service = GetPrefService(); | 885 const PrefService* pref_service = GetPrefService(); |
886 if (!pref_service) | 886 if (!pref_service) |
887 return; | 887 return; |
888 *flags = GetRemappedModifierMasks(*pref_service, event, *flags); | 888 *flags = GetRemappedModifierMasks(*pref_service, event, *flags); |
889 } | 889 } |
890 | 890 |
891 int EventRewriter::RewriteModifierClick(const ui::MouseEvent& mouse_event, | 891 int EventRewriter::RewriteModifierClick(const ui::MouseEvent& mouse_event, |
892 int* flags) { | 892 int* flags) { |
893 // Remap Alt+Button1 to Button3. | 893 // Remap Search+Button1 to Button3. |
894 const int kAltLeftButton = (ui::EF_ALT_DOWN | ui::EF_LEFT_MOUSE_BUTTON); | 894 const int kSearchLeftButton = |
895 if (((*flags & kAltLeftButton) == kAltLeftButton) && | 895 (ui::EF_COMMAND_DOWN | ui::EF_LEFT_MOUSE_BUTTON); |
| 896 if (((*flags & kSearchLeftButton) == kSearchLeftButton) && |
896 ((mouse_event.type() == ui::ET_MOUSE_PRESSED) || | 897 ((mouse_event.type() == ui::ET_MOUSE_PRESSED) || |
897 pressed_device_ids_.count(mouse_event.source_device_id()))) { | 898 pressed_device_ids_.count(mouse_event.source_device_id()))) { |
898 *flags &= ~kAltLeftButton; | 899 *flags &= ~kSearchLeftButton; |
899 *flags |= ui::EF_RIGHT_MOUSE_BUTTON; | 900 *flags |= ui::EF_RIGHT_MOUSE_BUTTON; |
900 if (mouse_event.type() == ui::ET_MOUSE_PRESSED) | 901 if (mouse_event.type() == ui::ET_MOUSE_PRESSED) |
901 pressed_device_ids_.insert(mouse_event.source_device_id()); | 902 pressed_device_ids_.insert(mouse_event.source_device_id()); |
902 else | 903 else |
903 pressed_device_ids_.erase(mouse_event.source_device_id()); | 904 pressed_device_ids_.erase(mouse_event.source_device_id()); |
904 return ui::EF_RIGHT_MOUSE_BUTTON; | 905 return ui::EF_RIGHT_MOUSE_BUTTON; |
905 } | 906 } |
906 return ui::EF_NONE; | 907 return ui::EF_NONE; |
907 } | 908 } |
908 | 909 |
(...skipping 30 matching lines...) Expand all Loading... |
939 for (const auto& keyboard : keyboards) { | 940 for (const auto& keyboard : keyboards) { |
940 if (keyboard.id == device_id) { | 941 if (keyboard.id == device_id) { |
941 return KeyboardDeviceAddedInternal( | 942 return KeyboardDeviceAddedInternal( |
942 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); | 943 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); |
943 } | 944 } |
944 } | 945 } |
945 return kDeviceUnknown; | 946 return kDeviceUnknown; |
946 } | 947 } |
947 | 948 |
948 } // namespace chromeos | 949 } // namespace chromeos |
OLD | NEW |