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_WINDOW_TREE_HOST_X11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "ui/aura/window_tree_host.h" | 14 #include "ui/aura/window_tree_host.h" |
15 #include "ui/base/cursor/cursor_loader_x11.h" | 15 #include "ui/base/cursor/cursor_loader_x11.h" |
16 #include "ui/events/event_source.h" | 16 #include "ui/events/event_source.h" |
17 #include "ui/events/platform/platform_event_dispatcher.h" | 17 #include "ui/events/platform/platform_event_dispatcher.h" |
| 18 #include "ui/gfx/insets.h" |
18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
19 #include "ui/gfx/x/x11_atom_cache.h" | 20 #include "ui/gfx/x/x11_atom_cache.h" |
20 #include "ui/views/views_export.h" | 21 #include "ui/views/views_export.h" |
21 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" | 22 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" |
22 | 23 |
23 namespace gfx { | 24 namespace gfx { |
24 class ImageSkia; | 25 class ImageSkia; |
25 class ImageSkiaRep; | 26 class ImageSkiaRep; |
26 } | 27 } |
27 | 28 |
(...skipping 23 matching lines...) Expand all Loading... |
51 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); | 52 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); |
52 | 53 |
53 // Get all open top-level windows. This includes windows that may not be | 54 // 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 | 55 // visible. This list is sorted in their stacking order, i.e. the first window |
55 // is the topmost window. | 56 // is the topmost window. |
56 static std::vector<aura::Window*> GetAllOpenWindows(); | 57 static std::vector<aura::Window*> GetAllOpenWindows(); |
57 | 58 |
58 // Returns the current bounds in terms of the X11 Root Window. | 59 // Returns the current bounds in terms of the X11 Root Window. |
59 gfx::Rect GetX11RootWindowBounds() const; | 60 gfx::Rect GetX11RootWindowBounds() const; |
60 | 61 |
| 62 // Returns the current bounds in terms of the X11 Root Window including the |
| 63 // borders provided by the window manager (if any). |
| 64 gfx::Rect GetX11RootWindowOuterBounds() const; |
| 65 |
| 66 // Returns the window shape if the window is not rectangular. Returns NULL |
| 67 // otherwise. |
| 68 ::Region GetWindowShape() const; |
| 69 |
61 // Called by X11DesktopHandler to notify us that the native windowing system | 70 // Called by X11DesktopHandler to notify us that the native windowing system |
62 // has changed our activation. | 71 // has changed our activation. |
63 void HandleNativeWidgetActivationChanged(bool active); | 72 void HandleNativeWidgetActivationChanged(bool active); |
64 | 73 |
65 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); | 74 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); |
66 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); | 75 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); |
67 | 76 |
68 // Deallocates the internal list of open windows. | 77 // Deallocates the internal list of open windows. |
69 static void CleanUpWindowList(); | 78 static void CleanUpWindowList(); |
70 | 79 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 160 |
152 private: | 161 private: |
153 // Initializes our X11 surface to draw on. This method performs all | 162 // Initializes our X11 surface to draw on. This method performs all |
154 // initialization related to talking to the X11 server. | 163 // initialization related to talking to the X11 server. |
155 void InitX11Window(const Widget::InitParams& params); | 164 void InitX11Window(const Widget::InitParams& params); |
156 | 165 |
157 // Creates an aura::WindowEventDispatcher to contain the |content_window|, | 166 // Creates an aura::WindowEventDispatcher to contain the |content_window|, |
158 // along with all aura client objects that direct behavior. | 167 // along with all aura client objects that direct behavior. |
159 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params); | 168 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params); |
160 | 169 |
| 170 // Called when |xwindow_|'s _NET_WM_STATE property is updated. |
| 171 void OnWMStateUpdated(); |
| 172 |
| 173 // Called when |xwindow_|'s _NET_FRAME_EXTENTS property is updated. |
| 174 void OnFrameExtentsUpdated(); |
| 175 |
161 // Sends a message to the x11 window manager, enabling or disabling the | 176 // Sends a message to the x11 window manager, enabling or disabling the |
162 // states |state1| and |state2|. | 177 // states |state1| and |state2|. |
163 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); | 178 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); |
164 | 179 |
165 // Checks if the window manager has set a specific state. | 180 // Checks if the window manager has set a specific state. |
166 bool HasWMSpecProperty(const char* property) const; | 181 bool HasWMSpecProperty(const char* property) const; |
167 | 182 |
168 // Sets whether the window's borders are provided by the window manager. | 183 // Sets whether the window's borders are provided by the window manager. |
169 void SetUseNativeFrame(bool use_native_frame); | 184 void SetUseNativeFrame(bool use_native_frame); |
170 | 185 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 283 |
269 aura::Window* content_window_; | 284 aura::Window* content_window_; |
270 | 285 |
271 // We can optionally have a parent which can order us to close, or own | 286 // We can optionally have a parent which can order us to close, or own |
272 // children who we're responsible for closing when we CloseNow(). | 287 // children who we're responsible for closing when we CloseNow(). |
273 DesktopWindowTreeHostX11* window_parent_; | 288 DesktopWindowTreeHostX11* window_parent_; |
274 std::set<DesktopWindowTreeHostX11*> window_children_; | 289 std::set<DesktopWindowTreeHostX11*> window_children_; |
275 | 290 |
276 ObserverList<DesktopWindowTreeHostObserverX11> observer_list_; | 291 ObserverList<DesktopWindowTreeHostObserverX11> observer_list_; |
277 | 292 |
278 // Copy of custom window shape specified via SetShape(), if any. | 293 // The window shape if the window is non-rectangular. |
279 ::Region custom_window_shape_; | 294 ::Region window_shape_; |
| 295 |
| 296 // Whether |window_shape_| was set via SetShape(). |
| 297 bool custom_window_shape_; |
| 298 |
| 299 // The size of the window manager provided borders (if any). |
| 300 gfx::Insets native_window_frame_borders_; |
280 | 301 |
281 // The current root window host that has capture. While X11 has something | 302 // The current root window host that has capture. While X11 has something |
282 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and | 303 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and |
283 // there are no notifications when this changes. We need to track this so we | 304 // there are no notifications when this changes. We need to track this so we |
284 // can notify widgets when they have lost capture, which controls a bunch of | 305 // can notify widgets when they have lost capture, which controls a bunch of |
285 // things in views like hiding menus. | 306 // things in views like hiding menus. |
286 static DesktopWindowTreeHostX11* g_current_capture; | 307 static DesktopWindowTreeHostX11* g_current_capture; |
287 | 308 |
288 // A list of all (top-level) windows that have been created but not yet | 309 // A list of all (top-level) windows that have been created but not yet |
289 // destroyed. | 310 // destroyed. |
290 static std::list<XID>* open_windows_; | 311 static std::list<XID>* open_windows_; |
291 | 312 |
292 scoped_ptr<X11ScopedCapture> x11_capture_; | 313 scoped_ptr<X11ScopedCapture> x11_capture_; |
293 | 314 |
294 base::string16 window_title_; | 315 base::string16 window_title_; |
295 | 316 |
296 // Whether we currently are flashing our frame. This feature is implemented | 317 // Whether we currently are flashing our frame. This feature is implemented |
297 // by setting the urgency hint with the window manager, which can draw | 318 // by setting the urgency hint with the window manager, which can draw |
298 // attention to the window or completely ignore the hint. We stop flashing | 319 // attention to the window or completely ignore the hint. We stop flashing |
299 // the frame when |xwindow_| gains focus or handles a mouse button event. | 320 // the frame when |xwindow_| gains focus or handles a mouse button event. |
300 bool urgency_hint_set_; | 321 bool urgency_hint_set_; |
301 | 322 |
302 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 323 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
303 }; | 324 }; |
304 | 325 |
305 } // namespace views | 326 } // namespace views |
306 | 327 |
307 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 328 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |