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 "ash/accelerators/accelerator_dispatcher.h" | 5 #include "ash/accelerators/accelerator_dispatcher.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/platform/platform_event_dispatcher.h" | 10 #include "ui/events/platform/platform_event_dispatcher.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // ui::PlatformEventDispatcher: | 58 // ui::PlatformEventDispatcher: |
59 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE { | 59 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE { |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { | 63 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { |
64 if (IsKeyEvent(event)) { | 64 if (IsKeyEvent(event)) { |
65 ui::KeyEvent key_event(event, false); | 65 ui::KeyEvent key_event(event, false); |
66 if (MenuClosedForPossibleAccelerator(key_event)) { | 66 if (MenuClosedForPossibleAccelerator(key_event)) { |
| 67 #if defined(USE_X11) |
67 XPutBackEvent(event->xany.display, event); | 68 XPutBackEvent(event->xany.display, event); |
| 69 #else |
| 70 NOTIMPLEMENTED(); |
| 71 #endif |
68 return ui::POST_DISPATCH_QUIT_LOOP; | 72 return ui::POST_DISPATCH_QUIT_LOOP; |
69 } | 73 } |
70 | 74 |
71 if (AcceleratorProcessedForKeyEvent(key_event)) | 75 if (AcceleratorProcessedForKeyEvent(key_event)) |
72 return ui::POST_DISPATCH_NONE; | 76 return ui::POST_DISPATCH_NONE; |
73 } | 77 } |
74 | 78 |
75 ui::PlatformEventDispatcher* prev = *restore_dispatcher_; | 79 ui::PlatformEventDispatcher* prev = *restore_dispatcher_; |
76 return prev ? prev->DispatchEvent(event) | 80 return prev ? prev->DispatchEvent(event) |
77 : ui::POST_DISPATCH_PERFORM_DEFAULT; | 81 : ui::POST_DISPATCH_PERFORM_DEFAULT; |
78 } | 82 } |
79 | 83 |
80 scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_; | 84 scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_; |
81 | 85 |
82 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcherLinux); | 86 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcherLinux); |
83 }; | 87 }; |
84 | 88 |
85 scoped_ptr<AcceleratorDispatcher> AcceleratorDispatcher::Create( | 89 scoped_ptr<AcceleratorDispatcher> AcceleratorDispatcher::Create( |
86 base::MessagePumpDispatcher* nested_dispatcher) { | 90 base::MessagePumpDispatcher* nested_dispatcher) { |
87 return scoped_ptr<AcceleratorDispatcher>(new AcceleratorDispatcherLinux()); | 91 return scoped_ptr<AcceleratorDispatcher>(new AcceleratorDispatcherLinux()); |
88 } | 92 } |
89 | 93 |
90 } // namespace ash | 94 } // namespace ash |
OLD | NEW |