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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // A singleton that owns global objects related to the desktop and listens for | 24 // A singleton that owns global objects related to the desktop and listens for |
25 // X11 events on the X11 root window. Destroys itself when aura::Env is | 25 // X11 events on the X11 root window. Destroys itself when aura::Env is |
26 // deleted. | 26 // deleted. |
27 class VIEWS_EXPORT X11DesktopHandler : public ui::PlatformEventDispatcher, | 27 class VIEWS_EXPORT X11DesktopHandler : public ui::PlatformEventDispatcher, |
28 public aura::EnvObserver { | 28 public aura::EnvObserver { |
29 public: | 29 public: |
30 // Returns the singleton handler. | 30 // Returns the singleton handler. |
31 static X11DesktopHandler* get(); | 31 static X11DesktopHandler* get(); |
32 | 32 |
| 33 // Gets/sets the X11 server time of the most recent mouse click, touch or |
| 34 // key press on a Chrome window. |
| 35 int wm_user_time_ms() const { |
| 36 return wm_user_time_ms_; |
| 37 } |
| 38 void set_wm_user_time_ms(unsigned long time_ms) { |
| 39 wm_user_time_ms_ = time_ms; |
| 40 } |
| 41 |
33 // Sends a request to the window manager to activate |window|. | 42 // Sends a request to the window manager to activate |window|. |
34 // This method should only be called if the window is already mapped. | 43 // This method should only be called if the window is already mapped. |
35 void ActivateWindow(::Window window); | 44 void ActivateWindow(::Window window); |
36 | 45 |
37 // Checks if the current active window is |window|. | 46 // Checks if the current active window is |window|. |
38 bool IsActiveWindow(::Window window) const; | 47 bool IsActiveWindow(::Window window) const; |
39 | 48 |
40 // Processes activation/focus related events. Some of these events are | 49 // Processes activation/focus related events. Some of these events are |
41 // dispatched to the X11 window dispatcher, and not to the X11 root-window | 50 // dispatched to the X11 window dispatcher, and not to the X11 root-window |
42 // dispatcher. The window dispatcher sends these events to here. | 51 // dispatcher. The window dispatcher sends these events to here. |
(...skipping 13 matching lines...) Expand all Loading... |
56 | 65 |
57 // Handles changes in activation. | 66 // Handles changes in activation. |
58 void OnActiveWindowChanged(::Window window); | 67 void OnActiveWindowChanged(::Window window); |
59 | 68 |
60 // The display and the native X window hosting the root window. | 69 // The display and the native X window hosting the root window. |
61 XDisplay* xdisplay_; | 70 XDisplay* xdisplay_; |
62 | 71 |
63 // The native root window. | 72 // The native root window. |
64 ::Window x_root_window_; | 73 ::Window x_root_window_; |
65 | 74 |
| 75 // The X11 server time of the most recent mouse click, touch, or key press |
| 76 // on a Chrome window. |
| 77 unsigned long wm_user_time_ms_; |
| 78 |
66 // The activated window. | 79 // The activated window. |
67 ::Window current_window_; | 80 ::Window current_window_; |
68 | 81 |
69 ui::X11AtomCache atom_cache_; | 82 ui::X11AtomCache atom_cache_; |
70 | 83 |
71 bool wm_supports_active_window_; | 84 bool wm_supports_active_window_; |
72 | 85 |
73 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); | 86 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); |
74 }; | 87 }; |
75 | 88 |
76 } // namespace views | 89 } // namespace views |
77 | 90 |
78 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ | 91 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ |
OLD | NEW |