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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
161 // Returns true if there's an X window manager present... in most cases. Some | 170 // Returns true if there's an X window manager present... in most cases. Some |
162 // window managers (notably, ion3) don't implement enough of ICCCM for us to | 171 // window managers (notably, ion3) don't implement enough of ICCCM for us to |
163 // detect that they're there. | 172 // detect that they're there. |
164 bool IsWindowManagerPresent(); | 173 bool IsWindowManagerPresent(); |
165 | 174 |
| 175 // Called when |xwindow_|'s _NET_WM_STATE property is updated. |
| 176 void OnWMStateUpdated(); |
| 177 |
| 178 // Called when |xwindow_|'s _NET_FRAME_EXTENTS property is updated. |
| 179 void OnFrameExtentsUpdated(); |
| 180 |
166 // Sends a message to the x11 window manager, enabling or disabling the | 181 // Sends a message to the x11 window manager, enabling or disabling the |
167 // states |state1| and |state2|. | 182 // states |state1| and |state2|. |
168 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); | 183 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); |
169 | 184 |
170 // Checks if the window manager has set a specific state. | 185 // Checks if the window manager has set a specific state. |
171 bool HasWMSpecProperty(const char* property) const; | 186 bool HasWMSpecProperty(const char* property) const; |
172 | 187 |
173 // Sets whether the window's borders are provided by the window manager. | 188 // Sets whether the window's borders are provided by the window manager. |
174 void SetUseNativeFrame(bool use_native_frame); | 189 void SetUseNativeFrame(bool use_native_frame); |
175 | 190 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 288 |
274 aura::Window* content_window_; | 289 aura::Window* content_window_; |
275 | 290 |
276 // We can optionally have a parent which can order us to close, or own | 291 // We can optionally have a parent which can order us to close, or own |
277 // children who we're responsible for closing when we CloseNow(). | 292 // children who we're responsible for closing when we CloseNow(). |
278 DesktopWindowTreeHostX11* window_parent_; | 293 DesktopWindowTreeHostX11* window_parent_; |
279 std::set<DesktopWindowTreeHostX11*> window_children_; | 294 std::set<DesktopWindowTreeHostX11*> window_children_; |
280 | 295 |
281 ObserverList<DesktopWindowTreeHostObserverX11> observer_list_; | 296 ObserverList<DesktopWindowTreeHostObserverX11> observer_list_; |
282 | 297 |
283 // Copy of custom window shape specified via SetShape(), if any. | 298 // The window shape if the window is non-rectangular. |
284 ::Region custom_window_shape_; | 299 ::Region window_shape_; |
| 300 |
| 301 // Whether |window_shape_| was set via SetShape(). |
| 302 bool custom_window_shape_; |
| 303 |
| 304 // The size of the window manager provided borders (if any). |
| 305 gfx::Insets native_window_frame_borders_; |
285 | 306 |
286 // The current root window host that has capture. While X11 has something | 307 // The current root window host that has capture. While X11 has something |
287 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and | 308 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and |
288 // there are no notifications when this changes. We need to track this so we | 309 // there are no notifications when this changes. We need to track this so we |
289 // can notify widgets when they have lost capture, which controls a bunch of | 310 // can notify widgets when they have lost capture, which controls a bunch of |
290 // things in views like hiding menus. | 311 // things in views like hiding menus. |
291 static DesktopWindowTreeHostX11* g_current_capture; | 312 static DesktopWindowTreeHostX11* g_current_capture; |
292 | 313 |
293 // A list of all (top-level) windows that have been created but not yet | 314 // A list of all (top-level) windows that have been created but not yet |
294 // destroyed. | 315 // destroyed. |
295 static std::list<XID>* open_windows_; | 316 static std::list<XID>* open_windows_; |
296 | 317 |
297 scoped_ptr<X11ScopedCapture> x11_capture_; | 318 scoped_ptr<X11ScopedCapture> x11_capture_; |
298 | 319 |
299 base::string16 window_title_; | 320 base::string16 window_title_; |
300 | 321 |
301 // Whether we currently are flashing our frame. This feature is implemented | 322 // Whether we currently are flashing our frame. This feature is implemented |
302 // by setting the urgency hint with the window manager, which can draw | 323 // by setting the urgency hint with the window manager, which can draw |
303 // attention to the window or completely ignore the hint. We stop flashing | 324 // attention to the window or completely ignore the hint. We stop flashing |
304 // the frame when |xwindow_| gains focus or handles a mouse button event. | 325 // the frame when |xwindow_| gains focus or handles a mouse button event. |
305 bool urgency_hint_set_; | 326 bool urgency_hint_set_; |
306 | 327 |
307 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 328 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
308 }; | 329 }; |
309 | 330 |
310 } // namespace views | 331 } // namespace views |
311 | 332 |
312 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 333 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |