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_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ |
7 | 7 |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 9 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
10 #undef RootWindow | 10 #undef RootWindow |
11 | 11 |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_pump_dispatcher.h" |
13 #include "ui/aura/env_observer.h" | 13 #include "ui/aura/env_observer.h" |
14 #include "ui/gfx/x/x11_atom_cache.h" | 14 #include "ui/gfx/x/x11_atom_cache.h" |
15 #include "ui/gfx/x/x11_types.h" | 15 #include "ui/gfx/x/x11_types.h" |
16 #include "ui/views/views_export.h" | 16 #include "ui/views/views_export.h" |
17 | 17 |
18 template <typename T> struct DefaultSingletonTraits; | 18 template <typename T> struct DefaultSingletonTraits; |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 // A singleton that owns global objects related to the desktop and listens for | 22 // A singleton that owns global objects related to the desktop and listens for |
23 // X11 events on the X11 root window. Destroys itself when aura::Env is | 23 // X11 events on the X11 root window. Destroys itself when aura::Env is |
24 // deleted. | 24 // deleted. |
25 class VIEWS_EXPORT X11DesktopHandler : public base::MessageLoop::Dispatcher, | 25 class VIEWS_EXPORT X11DesktopHandler : public base::MessagePumpDispatcher, |
26 public aura::EnvObserver { | 26 public aura::EnvObserver { |
27 public: | 27 public: |
28 // Returns the singleton handler. | 28 // Returns the singleton handler. |
29 static X11DesktopHandler* get(); | 29 static X11DesktopHandler* get(); |
30 | 30 |
31 // Sends a request to the window manager to activate |window|. | 31 // Sends a request to the window manager to activate |window|. |
32 void ActivateWindow(::Window window); | 32 void ActivateWindow(::Window window); |
33 | 33 |
34 // Checks if the current active window is |window|. | 34 // Checks if the current active window is |window|. |
35 bool IsActiveWindow(::Window window) const; | 35 bool IsActiveWindow(::Window window) const; |
36 | 36 |
37 // Processes activation/focus related events. Some of these events are | 37 // Processes activation/focus related events. Some of these events are |
38 // dispatched to the X11 window dispatcher, and not to the X11 root-window | 38 // dispatched to the X11 window dispatcher, and not to the X11 root-window |
39 // dispatcher. The window dispatcher sends these events to here. | 39 // dispatcher. The window dispatcher sends these events to here. |
40 void ProcessXEvent(const base::NativeEvent& event); | 40 void ProcessXEvent(const base::NativeEvent& event); |
41 | 41 |
42 // Overridden from MessageLoop::Dispatcher: | 42 // Overridden from MessagePumpDispatcher: |
43 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 43 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
44 | 44 |
45 // Overridden from aura::EnvObserver: | 45 // Overridden from aura::EnvObserver: |
46 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; | 46 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; |
47 virtual void OnWillDestroyEnv() OVERRIDE; | 47 virtual void OnWillDestroyEnv() OVERRIDE; |
48 | 48 |
49 private: | 49 private: |
50 explicit X11DesktopHandler(); | 50 explicit X11DesktopHandler(); |
51 virtual ~X11DesktopHandler(); | 51 virtual ~X11DesktopHandler(); |
52 | 52 |
(...skipping 12 matching lines...) Expand all Loading... |
65 ui::X11AtomCache atom_cache_; | 65 ui::X11AtomCache atom_cache_; |
66 | 66 |
67 bool wm_supports_active_window_; | 67 bool wm_supports_active_window_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); | 69 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace views | 72 } // namespace views |
73 | 73 |
74 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ | 74 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ |
OLD | NEW |