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