OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_AURA_DISPATCHER_LINUX_H_ | 5 #ifndef UI_AURA_DISPATCHER_LINUX_H_ |
6 #define UI_AURA_DISPATCHER_LINUX_H_ | 6 #define UI_AURA_DISPATCHER_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | |
10 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
11 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 12 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
12 #undef RootWindow | 13 #undef RootWindow |
13 | 14 |
14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
17 | 18 |
18 namespace aura { | 19 namespace aura { |
19 | 20 |
20 class DispatcherLinux : public MessageLoop::Dispatcher, | 21 class DispatcherLinux : public MessageLoop::Dispatcher, |
21 public base::MessagePumpObserver { | 22 public base::MessagePumpObserver { |
22 public: | 23 public: |
23 DispatcherLinux(); | 24 DispatcherLinux(); |
24 virtual ~DispatcherLinux(); | 25 virtual ~DispatcherLinux(); |
25 | 26 |
26 void WindowDispatcherCreated(::Window window, | 27 // Registers/Unregisters |dispatcher| for the |x_window|. |
27 MessageLoop::Dispatcher* dispatcher); | 28 void RegisterDispatcherForWindow(MessageLoop::Dispatcher* dispatcher, |
Ben Goodger (Google)
2012/05/22 23:44:40
AddDispatcher
oshima
2012/05/23 00:31:06
Done.
| |
28 void WindowDispatcherDestroying(::Window window); | 29 ::Window x_window); |
30 void UnregisterDispatcherForWindow(::Window x_window); | |
Ben Goodger (Google)
2012/05/22 23:44:40
RemoveDispatcher
oshima
2012/05/23 00:31:06
Done.
| |
31 | |
32 // Registers/Unregisters |dispatcher| to receive all events sent to the X | |
33 // root wnidow. | |
Ben Goodger (Google)
2012/05/22 23:44:40
window.
oshima
2012/05/23 00:31:06
Done.
| |
34 void RegisterDispatcherForRootWindow(MessageLoop::Dispatcher* dispatcher); | |
35 void UnregisterDispatcherForRootWindow(MessageLoop::Dispatcher* dispatcher); | |
Ben Goodger (Google)
2012/05/22 23:44:40
etc
oshima
2012/05/23 00:31:06
Done.
| |
29 | 36 |
30 // Overridden from MessageLoop::Dispatcher: | 37 // Overridden from MessageLoop::Dispatcher: |
31 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 38 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
32 | 39 |
33 // Overridden from base::MessagePumpObserver: | 40 // Overridden from base::MessagePumpObserver: |
34 virtual base::EventStatus WillProcessEvent( | 41 virtual base::EventStatus WillProcessEvent( |
35 const base::NativeEvent& event) OVERRIDE; | 42 const base::NativeEvent& event) OVERRIDE; |
36 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | 43 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
37 | 44 |
38 private: | 45 private: |
39 typedef std::map< ::Window, MessageLoop::Dispatcher* > DispatchersMap; | 46 typedef std::map< ::Window, MessageLoop::Dispatcher* > DispatchersMap; |
47 typedef std::vector<MessageLoop::Dispatcher*> Dispatchers; | |
40 | 48 |
41 MessageLoop::Dispatcher* GetDispatcherForXEvent(XEvent* xev) const; | 49 MessageLoop::Dispatcher* GetDispatcherForXEvent(XEvent* xev) const; |
42 | 50 |
43 DispatchersMap dispatchers_; | 51 DispatchersMap dispatchers_; |
52 Dispatchers root_window_dispatchers_; | |
53 | |
54 ::Window x_root_window_; | |
44 | 55 |
45 DISALLOW_COPY_AND_ASSIGN(DispatcherLinux); | 56 DISALLOW_COPY_AND_ASSIGN(DispatcherLinux); |
46 }; | 57 }; |
47 | 58 |
48 } // namespace aura | 59 } // namespace aura |
49 | 60 |
50 #endif // UI_AURA_DISPATCHER_LINUX_H_ | 61 #endif // UI_AURA_DISPATCHER_LINUX_H_ |
OLD | NEW |