| 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/sticky_keys/sticky_keys_controller.h" | 5 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 #undef None | 8 #undef None |
| 9 #undef Bool | 9 #undef Bool |
| 10 #undef RootWindow | 10 #undef RootWindow |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 ui::KeyEvent* GenerateSynthesizedKeyEvent(ui::EventType type, | 122 ui::KeyEvent* GenerateSynthesizedKeyEvent(ui::EventType type, |
| 123 ui::KeyboardCode code) { | 123 ui::KeyboardCode code) { |
| 124 return new ui::KeyEvent(type, code, ui::EF_NONE); | 124 return new ui::KeyEvent(type, code, ui::EF_NONE); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Creates a synthesized MouseEvent that is not backed by a native event. | 127 // Creates a synthesized MouseEvent that is not backed by a native event. |
| 128 ui::MouseEvent* GenerateSynthesizedMouseEventAt(ui::EventType event_type, | 128 ui::MouseEvent* GenerateSynthesizedMouseEventAt(ui::EventType event_type, |
| 129 const gfx::Point& location) { | 129 const gfx::Point& location) { |
| 130 ui::MouseEvent* event = new ui::MouseEvent( | 130 ui::MouseEvent* event = new ui::MouseEvent( |
| 131 event_type, location, location, ui::EventTimeForNow(), | 131 event_type, location, location, ui::EventTimeForNow(), |
| 132 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 132 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 133 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 133 ui::Event::DispatcherApi dispatcher(event); | 134 ui::Event::DispatcherApi dispatcher(event); |
| 134 dispatcher.set_target(target_); | 135 dispatcher.set_target(target_); |
| 135 return event; | 136 return event; |
| 136 } | 137 } |
| 137 | 138 |
| 138 // Creates a synthesized mouse press or release event. | 139 // Creates a synthesized mouse press or release event. |
| 139 ui::MouseEvent* GenerateSynthesizedMouseClickEvent( | 140 ui::MouseEvent* GenerateSynthesizedMouseClickEvent( |
| 140 ui::EventType type, | 141 ui::EventType type, |
| 141 const gfx::Point& location) { | 142 const gfx::Point& location) { |
| 142 return GenerateSynthesizedMouseEventAt(type, location); | 143 return GenerateSynthesizedMouseEventAt(type, location); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 gfx::Point(0, 0))); | 700 gfx::Point(0, 0))); |
| 700 released = false; | 701 released = false; |
| 701 mod_down_flags = 0; | 702 mod_down_flags = 0; |
| 702 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released); | 703 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released); |
| 703 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN); | 704 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN); |
| 704 EXPECT_TRUE(released); | 705 EXPECT_TRUE(released); |
| 705 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state()); | 706 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state()); |
| 706 } | 707 } |
| 707 | 708 |
| 708 } // namespace ash | 709 } // namespace ash |
| OLD | NEW |