| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
| 11 #undef RootWindow | 11 #undef RootWindow |
| 12 | 12 |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "ui/aura/env_observer.h" | 17 #include "ui/aura/env_observer.h" |
| 18 #include "ui/events/platform/platform_event_dispatcher.h" | 18 #include "ui/events/platform/platform_event_dispatcher.h" |
| 19 #include "ui/events/platform/x11/x11_event_source.h" | 19 #include "ui/events/platform/x11/x11_event_source.h" |
| 20 #include "ui/gfx/x/x11_atom_cache.h" | 20 #include "ui/gfx/x/x11_atom_cache.h" |
| 21 #include "ui/gfx/x/x11_types.h" | 21 #include "ui/gfx/x/x11_types.h" |
| 22 #include "ui/views/views_export.h" | 22 #include "ui/views/views_export.h" |
| 23 #include "ui/views/widget/desktop_aura/x11_desktop_handler_observer.h" | 23 #include "ui/views/widget/desktop_aura/x11_desktop_handler_observer.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 template <typename T> struct DefaultSingletonTraits; | 26 template <typename T> struct DefaultSingletonTraits; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace ui { |
| 30 class XScopedEventSelector; |
| 31 } |
| 32 |
| 29 namespace views { | 33 namespace views { |
| 30 | 34 |
| 31 // A singleton that owns global objects related to the desktop and listens for | 35 // A singleton that owns global objects related to the desktop and listens for |
| 32 // X11 events on the X11 root window. Destroys itself when aura::Env is | 36 // X11 events on the X11 root window. Destroys itself when aura::Env is |
| 33 // deleted. | 37 // deleted. |
| 34 class VIEWS_EXPORT X11DesktopHandler : public ui::PlatformEventDispatcher, | 38 class VIEWS_EXPORT X11DesktopHandler : public ui::PlatformEventDispatcher, |
| 35 public aura::EnvObserver { | 39 public aura::EnvObserver { |
| 36 public: | 40 public: |
| 37 // Returns the singleton handler. | 41 // Returns the singleton handler. |
| 38 static X11DesktopHandler* get(); | 42 static X11DesktopHandler* get(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 62 | 66 |
| 63 // Makes a round trip to the X server to get the current workspace. | 67 // Makes a round trip to the X server to get the current workspace. |
| 64 bool UpdateWorkspace(); | 68 bool UpdateWorkspace(); |
| 65 | 69 |
| 66 // The display and the native X window hosting the root window. | 70 // The display and the native X window hosting the root window. |
| 67 XDisplay* xdisplay_; | 71 XDisplay* xdisplay_; |
| 68 | 72 |
| 69 // The native root window. | 73 // The native root window. |
| 70 ::Window x_root_window_; | 74 ::Window x_root_window_; |
| 71 | 75 |
| 76 // Events selected on x_root_window_. |
| 77 std::unique_ptr<ui::XScopedEventSelector> x_root_window_events_; |
| 78 |
| 72 ui::X11AtomCache atom_cache_; | 79 ui::X11AtomCache atom_cache_; |
| 73 | 80 |
| 74 base::ObserverList<X11DesktopHandlerObserver> observers_; | 81 base::ObserverList<X11DesktopHandlerObserver> observers_; |
| 75 | 82 |
| 76 std::string workspace_; | 83 std::string workspace_; |
| 77 | 84 |
| 78 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); | 85 DISALLOW_COPY_AND_ASSIGN(X11DesktopHandler); |
| 79 }; | 86 }; |
| 80 | 87 |
| 81 } // namespace views | 88 } // namespace views |
| 82 | 89 |
| 83 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ | 90 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_HANDLER_H_ |
| OLD | NEW |