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_DESKTOP_ROOT_WINDOW_HOST_X11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ |
7 | 7 |
8 #include <X11/extensions/shape.h> | 8 #include <X11/extensions/shape.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" | 22 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
23 | 23 |
24 namespace gfx { | 24 namespace gfx { |
25 class ImageSkia; | 25 class ImageSkia; |
26 class ImageSkiaRep; | 26 class ImageSkiaRep; |
27 } | 27 } |
28 | 28 |
29 namespace views { | 29 namespace views { |
30 class DesktopDragDropClientAuraX11; | 30 class DesktopDragDropClientAuraX11; |
31 class DesktopDispatcherClient; | 31 class DesktopDispatcherClient; |
32 class DesktopRootWindowHostObserverX11; | 32 class DesktopWindowTreeHostObserverX11; |
33 class X11DesktopWindowMoveClient; | 33 class X11DesktopWindowMoveClient; |
34 class X11ScopedCapture; | 34 class X11ScopedCapture; |
35 class X11WindowEventFilter; | 35 class X11WindowEventFilter; |
36 | 36 |
37 class VIEWS_EXPORT DesktopRootWindowHostX11 : | 37 class VIEWS_EXPORT DesktopWindowTreeHostX11 : |
38 public DesktopRootWindowHost, | 38 public DesktopWindowTreeHost, |
39 public aura::RootWindowHost, | 39 public aura::WindowTreeHost, |
40 public base::MessageLoop::Dispatcher { | 40 public base::MessageLoop::Dispatcher { |
41 public: | 41 public: |
42 DesktopRootWindowHostX11( | 42 DesktopWindowTreeHostX11( |
43 internal::NativeWidgetDelegate* native_widget_delegate, | 43 internal::NativeWidgetDelegate* native_widget_delegate, |
44 DesktopNativeWidgetAura* desktop_native_widget_aura); | 44 DesktopNativeWidgetAura* desktop_native_widget_aura); |
45 virtual ~DesktopRootWindowHostX11(); | 45 virtual ~DesktopWindowTreeHostX11(); |
46 | 46 |
47 // A way of converting an X11 |xid| host window into a |content_window_|. | 47 // A way of converting an X11 |xid| host window into a |content_window_|. |
48 static aura::Window* GetContentWindowForXID(XID xid); | 48 static aura::Window* GetContentWindowForXID(XID xid); |
49 | 49 |
50 // A way of converting an X11 |xid| host window into this object. | 50 // A way of converting an X11 |xid| host window into this object. |
51 static DesktopRootWindowHostX11* GetHostForXID(XID xid); | 51 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); |
52 | 52 |
53 // Get all open top-level windows. This includes windows that may not be | 53 // Get all open top-level windows. This includes windows that may not be |
54 // visible. This list is sorted in their stacking order, i.e. the first window | 54 // visible. This list is sorted in their stacking order, i.e. the first window |
55 // is the topmost window. | 55 // is the topmost window. |
56 static std::vector<aura::Window*> GetAllOpenWindows(); | 56 static std::vector<aura::Window*> GetAllOpenWindows(); |
57 | 57 |
58 // Returns the current bounds in terms of the X11 Root Window. | 58 // Returns the current bounds in terms of the X11 Root Window. |
59 gfx::Rect GetX11RootWindowBounds() const; | 59 gfx::Rect GetX11RootWindowBounds() const; |
60 | 60 |
61 // Called by X11DesktopHandler to notify us that the native windowing system | 61 // Called by X11DesktopHandler to notify us that the native windowing system |
62 // has changed our activation. | 62 // has changed our activation. |
63 void HandleNativeWidgetActivationChanged(bool active); | 63 void HandleNativeWidgetActivationChanged(bool active); |
64 | 64 |
65 void AddObserver(views::DesktopRootWindowHostObserverX11* observer); | 65 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); |
66 void RemoveObserver(views::DesktopRootWindowHostObserverX11* observer); | 66 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); |
67 | 67 |
68 // Deallocates the internal list of open windows. | 68 // Deallocates the internal list of open windows. |
69 static void CleanUpWindowList(); | 69 static void CleanUpWindowList(); |
70 | 70 |
71 protected: | 71 protected: |
72 // Overridden from DesktopRootWindowHost: | 72 // Overridden from DesktopWindowTreeHost: |
73 virtual void Init(aura::Window* content_window, | 73 virtual void Init(aura::Window* content_window, |
74 const Widget::InitParams& params, | 74 const Widget::InitParams& params, |
75 aura::RootWindow::CreateParams* rw_create_params) OVERRIDE; | 75 aura::RootWindow::CreateParams* rw_create_params) OVERRIDE; |
76 virtual void OnRootWindowCreated(aura::RootWindow* root, | 76 virtual void OnRootWindowCreated(aura::RootWindow* root, |
77 const Widget::InitParams& params) OVERRIDE; | 77 const Widget::InitParams& params) OVERRIDE; |
78 virtual scoped_ptr<corewm::Tooltip> CreateTooltip() OVERRIDE; | 78 virtual scoped_ptr<corewm::Tooltip> CreateTooltip() OVERRIDE; |
79 virtual scoped_ptr<aura::client::DragDropClient> | 79 virtual scoped_ptr<aura::client::DragDropClient> |
80 CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) OVERRIDE; | 80 CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) OVERRIDE; |
81 virtual void Close() OVERRIDE; | 81 virtual void Close() OVERRIDE; |
82 virtual void CloseNow() OVERRIDE; | 82 virtual void CloseNow() OVERRIDE; |
83 virtual aura::RootWindowHost* AsRootWindowHost() OVERRIDE; | 83 virtual aura::WindowTreeHost* AsWindowTreeHost() OVERRIDE; |
84 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; | 84 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; |
85 virtual void ShowMaximizedWithBounds( | 85 virtual void ShowMaximizedWithBounds( |
86 const gfx::Rect& restored_bounds) OVERRIDE; | 86 const gfx::Rect& restored_bounds) OVERRIDE; |
87 virtual bool IsVisible() const OVERRIDE; | 87 virtual bool IsVisible() const OVERRIDE; |
88 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 88 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
89 virtual void StackAtTop() OVERRIDE; | 89 virtual void StackAtTop() OVERRIDE; |
90 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; | 90 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; |
91 virtual void GetWindowPlacement( | 91 virtual void GetWindowPlacement( |
92 gfx::Rect* bounds, | 92 gfx::Rect* bounds, |
93 ui::WindowShowState* show_state) const OVERRIDE; | 93 ui::WindowShowState* show_state) const OVERRIDE; |
(...skipping 29 matching lines...) Expand all Loading... |
123 virtual void SetOpacity(unsigned char opacity) OVERRIDE; | 123 virtual void SetOpacity(unsigned char opacity) OVERRIDE; |
124 virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, | 124 virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, |
125 const gfx::ImageSkia& app_icon) OVERRIDE; | 125 const gfx::ImageSkia& app_icon) OVERRIDE; |
126 virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; | 126 virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; |
127 virtual void FlashFrame(bool flash_frame) OVERRIDE; | 127 virtual void FlashFrame(bool flash_frame) OVERRIDE; |
128 virtual void OnRootViewLayout() const OVERRIDE; | 128 virtual void OnRootViewLayout() const OVERRIDE; |
129 virtual void OnNativeWidgetFocus() OVERRIDE; | 129 virtual void OnNativeWidgetFocus() OVERRIDE; |
130 virtual void OnNativeWidgetBlur() OVERRIDE; | 130 virtual void OnNativeWidgetBlur() OVERRIDE; |
131 virtual bool IsAnimatingClosed() const OVERRIDE; | 131 virtual bool IsAnimatingClosed() const OVERRIDE; |
132 | 132 |
133 // Overridden from aura::RootWindowHost: | 133 // Overridden from aura::WindowTreeHost: |
134 virtual aura::RootWindow* GetRootWindow() OVERRIDE; | 134 virtual aura::RootWindow* GetRootWindow() OVERRIDE; |
135 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 135 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
136 virtual void Show() OVERRIDE; | 136 virtual void Show() OVERRIDE; |
137 virtual void Hide() OVERRIDE; | 137 virtual void Hide() OVERRIDE; |
138 virtual void ToggleFullScreen() OVERRIDE; | 138 virtual void ToggleFullScreen() OVERRIDE; |
139 virtual gfx::Rect GetBounds() const OVERRIDE; | 139 virtual gfx::Rect GetBounds() const OVERRIDE; |
140 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 140 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
141 virtual gfx::Insets GetInsets() const OVERRIDE; | 141 virtual gfx::Insets GetInsets() const OVERRIDE; |
142 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; | 142 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; |
143 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 143 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Serializes an image to the format used by _NET_WM_ICON. | 194 // Serializes an image to the format used by _NET_WM_ICON. |
195 void SerializeImageRepresentation(const gfx::ImageSkiaRep& rep, | 195 void SerializeImageRepresentation(const gfx::ImageSkiaRep& rep, |
196 std::vector<unsigned long>* data); | 196 std::vector<unsigned long>* data); |
197 | 197 |
198 // See comment for variable open_windows_. | 198 // See comment for variable open_windows_. |
199 static std::list<XID>& open_windows(); | 199 static std::list<XID>& open_windows(); |
200 | 200 |
201 // Overridden from Dispatcher: | 201 // Overridden from Dispatcher: |
202 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 202 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
203 | 203 |
204 base::WeakPtrFactory<DesktopRootWindowHostX11> close_widget_factory_; | 204 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
205 | 205 |
206 // X11 things | 206 // X11 things |
207 // The display and the native X window hosting the root window. | 207 // The display and the native X window hosting the root window. |
208 XDisplay* xdisplay_; | 208 XDisplay* xdisplay_; |
209 ::Window xwindow_; | 209 ::Window xwindow_; |
210 | 210 |
211 // The native root window. | 211 // The native root window. |
212 ::Window x_root_window_; | 212 ::Window x_root_window_; |
213 | 213 |
214 ui::X11AtomCache atom_cache_; | 214 ui::X11AtomCache atom_cache_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura | 256 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura |
257 // instead of providing this route back to Widget. | 257 // instead of providing this route back to Widget. |
258 internal::NativeWidgetDelegate* native_widget_delegate_; | 258 internal::NativeWidgetDelegate* native_widget_delegate_; |
259 | 259 |
260 DesktopNativeWidgetAura* desktop_native_widget_aura_; | 260 DesktopNativeWidgetAura* desktop_native_widget_aura_; |
261 | 261 |
262 aura::Window* content_window_; | 262 aura::Window* content_window_; |
263 | 263 |
264 // We can optionally have a parent which can order us to close, or own | 264 // We can optionally have a parent which can order us to close, or own |
265 // children who we're responsible for closing when we CloseNow(). | 265 // children who we're responsible for closing when we CloseNow(). |
266 DesktopRootWindowHostX11* window_parent_; | 266 DesktopWindowTreeHostX11* window_parent_; |
267 std::set<DesktopRootWindowHostX11*> window_children_; | 267 std::set<DesktopWindowTreeHostX11*> window_children_; |
268 | 268 |
269 ObserverList<DesktopRootWindowHostObserverX11> observer_list_; | 269 ObserverList<DesktopWindowTreeHostObserverX11> observer_list_; |
270 | 270 |
271 // Copy of custom window shape specified via SetShape(), if any. | 271 // Copy of custom window shape specified via SetShape(), if any. |
272 ::Region custom_window_shape_; | 272 ::Region custom_window_shape_; |
273 | 273 |
274 // The current root window host that has capture. While X11 has something | 274 // The current root window host that has capture. While X11 has something |
275 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and | 275 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and |
276 // there are no notifications when this changes. We need to track this so we | 276 // there are no notifications when this changes. We need to track this so we |
277 // can notify widgets when they have lost capture, which controls a bunch of | 277 // can notify widgets when they have lost capture, which controls a bunch of |
278 // things in views like hiding menus. | 278 // things in views like hiding menus. |
279 static DesktopRootWindowHostX11* g_current_capture; | 279 static DesktopWindowTreeHostX11* g_current_capture; |
280 | 280 |
281 // A list of all (top-level) windows that have been created but not yet | 281 // A list of all (top-level) windows that have been created but not yet |
282 // destroyed. | 282 // destroyed. |
283 static std::list<XID>* open_windows_; | 283 static std::list<XID>* open_windows_; |
284 | 284 |
285 scoped_ptr<X11ScopedCapture> x11_capture_; | 285 scoped_ptr<X11ScopedCapture> x11_capture_; |
286 | 286 |
287 base::string16 window_title_; | 287 base::string16 window_title_; |
288 | 288 |
289 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostX11); | 289 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
290 }; | 290 }; |
291 | 291 |
292 } // namespace views | 292 } // namespace views |
293 | 293 |
294 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ | 294 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ |
OLD | NEW |