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 #ifndef VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 5 #ifndef VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
6 #define VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 6 #define VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(OS_LINUX) | 11 #if defined(OS_LINUX) |
12 #include <gdk/gdk.h> | 12 #include <gdk/gdk.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include <set> | 15 #include <set> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "views/views_export.h" | 19 #include "views/views_export.h" |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 | 22 |
23 #if defined(TOUCH_UI) | 23 #if defined(TOUCH_UI) && !defined(USE_WAYLAND) |
24 // Dispatch an XEvent to the RootView. Return true if the event was dispatched | 24 // Dispatch an XEvent to the RootView. Return true if the event was dispatched |
25 // and handled, false otherwise. | 25 // and handled, false otherwise. |
26 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); | 26 bool VIEWS_EXPORT DispatchXEvent(XEvent* xevent); |
27 | 27 |
28 // Keep a list of touch devices so that it is possible to determine if a pointer | 28 // Keep a list of touch devices so that it is possible to determine if a pointer |
29 // event is a touch-event or a mouse-event. | 29 // event is a touch-event or a mouse-event. |
30 void VIEWS_EXPORT SetTouchDeviceList(std::vector<unsigned int>& devices); | 30 void VIEWS_EXPORT SetTouchDeviceList(std::vector<unsigned int>& devices); |
31 #endif // TOUCH_UI | 31 #endif // TOUCH_UI |
32 | 32 |
33 // This class delegates the key messages to the associated FocusManager class | 33 // This class delegates the key messages to the associated FocusManager class |
34 // for the window that is receiving these messages for accelerator processing. | 34 // for the window that is receiving these messages for accelerator processing. |
35 class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher { | 35 class VIEWS_EXPORT AcceleratorHandler : public MessageLoop::Dispatcher { |
36 public: | 36 public: |
37 AcceleratorHandler(); | 37 AcceleratorHandler(); |
38 | 38 |
39 // Dispatcher method. This returns true if an accelerator was processed by the | 39 // Dispatcher method. This returns true if an accelerator was processed by the |
40 // focus manager | 40 // focus manager |
41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
42 virtual bool Dispatch(const MSG& msg); | 42 virtual bool Dispatch(const MSG& msg); |
| 43 #elif defined(USE_WAYLAND) |
| 44 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( |
| 45 ui::WaylandEvent* ev); |
43 #elif defined(TOUCH_UI) | 46 #elif defined(TOUCH_UI) |
44 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xev); | 47 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xev); |
45 #else | 48 #else |
46 virtual bool Dispatch(GdkEvent* event); | 49 virtual bool Dispatch(GdkEvent* event); |
47 #endif | 50 #endif |
48 | 51 |
49 private: | 52 private: |
50 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
51 // The keys currently pressed and consumed by the FocusManager. | 54 // The keys currently pressed and consumed by the FocusManager. |
52 std::set<WPARAM> pressed_keys_; | 55 std::set<WPARAM> pressed_keys_; |
53 #endif | 56 #endif |
54 | 57 |
55 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); | 58 DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); |
56 }; | 59 }; |
57 | 60 |
58 } // namespace views | 61 } // namespace views |
59 | 62 |
60 #endif // VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ | 63 #endif // VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |
OLD | NEW |