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 // This method should only be called if the window is already mapped. | 32 // This method should only be called if the window is already mapped. |
33 void ActivateWindow(::Window window); | 33 void ActivateWindow(::Window window); |
34 | 34 |
35 // Checks if the current active window is |window|. | 35 // Checks if the current active window is |window|. |
36 bool IsActiveWindow(::Window window) const; | 36 bool IsActiveWindow(::Window window) const; |
37 | 37 |
38 // Processes activation/focus related events. Some of these events are | 38 // Processes activation/focus related events. Some of these events are |
39 // dispatched to the X11 window dispatcher, and not to the X11 root-window | 39 // dispatched to the X11 window dispatcher, and not to the X11 root-window |
40 // dispatcher. The window dispatcher sends these events to here. | 40 // dispatcher. The window dispatcher sends these events to here. |
41 void ProcessXEvent(const base::NativeEvent& event); | 41 void ProcessXEvent(const base::NativeEvent& event); |
42 | 42 |
43 // Overridden from MessageLoop::Dispatcher: | 43 // Overridden from MessagePumpDispatcher: |
44 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 44 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
45 | 45 |
46 // Overridden from aura::EnvObserver: | 46 // Overridden from aura::EnvObserver: |
47 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; | 47 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; |
48 virtual void OnWillDestroyEnv() OVERRIDE; | 48 virtual void OnWillDestroyEnv() OVERRIDE; |
49 | 49 |
50 private: | 50 private: |
51 explicit X11DesktopHandler(); | 51 explicit X11DesktopHandler(); |
52 virtual ~X11DesktopHandler(); | 52 virtual ~X11DesktopHandler(); |
53 | 53 |
(...skipping 12 matching lines...) Expand all Loading... |
66 ui::X11AtomCache atom_cache_; | 66 ui::X11AtomCache atom_cache_; |
67 | 67 |
68 bool wm_supports_active_window_; | 68 bool wm_supports_active_window_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); | 70 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace views | 73 } // namespace views |
74 | 74 |
75 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ | 75 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ |
OLD | NEW |