| 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/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 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 "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "ui/aura/client/cursor_client.h" | |
| 17 #include "ui/aura/root_window_host.h" | 16 #include "ui/aura/root_window_host.h" |
| 18 #include "ui/base/cursor/cursor_loader_x11.h" | 17 #include "ui/base/cursor/cursor_loader_x11.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_root_window_host.h" | 21 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
| 23 | 22 |
| 24 namespace aura { | |
| 25 namespace client { | |
| 26 class FocusClient; | |
| 27 class ScreenPositionClient; | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 namespace views { | 23 namespace views { |
| 32 class DesktopDragDropClientAuraX11; | 24 class DesktopDragDropClientAuraX11; |
| 33 class DesktopDispatcherClient; | 25 class DesktopDispatcherClient; |
| 34 class DesktopRootWindowHostObserverX11; | 26 class DesktopRootWindowHostObserverX11; |
| 35 class X11DesktopWindowMoveClient; | 27 class X11DesktopWindowMoveClient; |
| 36 class X11WindowEventFilter; | 28 class X11WindowEventFilter; |
| 37 | 29 |
| 38 namespace corewm { | |
| 39 class CursorManager; | |
| 40 } | |
| 41 | |
| 42 class VIEWS_EXPORT DesktopRootWindowHostX11 : | 30 class VIEWS_EXPORT DesktopRootWindowHostX11 : |
| 43 public DesktopRootWindowHost, | 31 public DesktopRootWindowHost, |
| 44 public aura::RootWindowHost, | 32 public aura::RootWindowHost, |
| 45 public base::MessageLoop::Dispatcher { | 33 public base::MessageLoop::Dispatcher { |
| 46 public: | 34 public: |
| 47 DesktopRootWindowHostX11( | 35 DesktopRootWindowHostX11( |
| 48 internal::NativeWidgetDelegate* native_widget_delegate, | 36 internal::NativeWidgetDelegate* native_widget_delegate, |
| 49 DesktopNativeWidgetAura* desktop_native_widget_aura, | 37 DesktopNativeWidgetAura* desktop_native_widget_aura); |
| 50 const gfx::Rect& initial_bounds); | |
| 51 virtual ~DesktopRootWindowHostX11(); | 38 virtual ~DesktopRootWindowHostX11(); |
| 52 | 39 |
| 53 // A way of converting an X11 |xid| host window into a |content_window_|. | 40 // A way of converting an X11 |xid| host window into a |content_window_|. |
| 54 static aura::Window* GetContentWindowForXID(XID xid); | 41 static aura::Window* GetContentWindowForXID(XID xid); |
| 55 | 42 |
| 56 // A way of converting an X11 |xid| host window into this object. | 43 // A way of converting an X11 |xid| host window into this object. |
| 57 static DesktopRootWindowHostX11* GetHostForXID(XID xid); | 44 static DesktopRootWindowHostX11* GetHostForXID(XID xid); |
| 58 | 45 |
| 59 // Get all open top-level windows. This includes windows that may not be | 46 // Get all open top-level windows. This includes windows that may not be |
| 60 // visible. | 47 // visible. |
| 61 static std::vector<aura::Window*> GetAllOpenWindows(); | 48 static std::vector<aura::Window*> GetAllOpenWindows(); |
| 62 | 49 |
| 63 // Returns the current bounds in terms of the X11 Root Window. | 50 // Returns the current bounds in terms of the X11 Root Window. |
| 64 gfx::Rect GetX11RootWindowBounds() const; | 51 gfx::Rect GetX11RootWindowBounds() const; |
| 65 | 52 |
| 66 // Called by X11DesktopHandler to notify us that the native windowing system | 53 // Called by X11DesktopHandler to notify us that the native windowing system |
| 67 // has changed our activation. | 54 // has changed our activation. |
| 68 void HandleNativeWidgetActivationChanged(bool active); | 55 void HandleNativeWidgetActivationChanged(bool active); |
| 69 | 56 |
| 70 void AddObserver(views::DesktopRootWindowHostObserverX11* observer); | 57 void AddObserver(views::DesktopRootWindowHostObserverX11* observer); |
| 71 void RemoveObserver(views::DesktopRootWindowHostObserverX11* observer); | 58 void RemoveObserver(views::DesktopRootWindowHostObserverX11* observer); |
| 72 | 59 |
| 73 // Deallocates the internal list of open windows. | 60 // Deallocates the internal list of open windows. |
| 74 static void CleanUpWindowList(); | 61 static void CleanUpWindowList(); |
| 75 | 62 |
| 76 protected: | 63 protected: |
| 77 // Overridden from DesktopRootWindowHost: | 64 // Overridden from DesktopRootWindowHost: |
| 78 virtual aura::RootWindow* Init(aura::Window* content_window, | 65 virtual void Init(aura::Window* content_window, |
| 79 const Widget::InitParams& params) OVERRIDE; | 66 const Widget::InitParams& params, |
| 67 aura::RootWindow::CreateParams* rw_create_params) OVERRIDE; |
| 68 virtual void OnRootWindowCreated(aura::RootWindow* root, |
| 69 const Widget::InitParams& params) OVERRIDE; |
| 80 virtual scoped_ptr<corewm::Tooltip> CreateTooltip() OVERRIDE; | 70 virtual scoped_ptr<corewm::Tooltip> CreateTooltip() OVERRIDE; |
| 71 virtual scoped_ptr<aura::client::DragDropClient> |
| 72 CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) OVERRIDE; |
| 81 virtual void Close() OVERRIDE; | 73 virtual void Close() OVERRIDE; |
| 82 virtual void CloseNow() OVERRIDE; | 74 virtual void CloseNow() OVERRIDE; |
| 83 virtual aura::RootWindowHost* AsRootWindowHost() OVERRIDE; | 75 virtual aura::RootWindowHost* AsRootWindowHost() OVERRIDE; |
| 84 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; | 76 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; |
| 85 virtual void ShowMaximizedWithBounds( | 77 virtual void ShowMaximizedWithBounds( |
| 86 const gfx::Rect& restored_bounds) OVERRIDE; | 78 const gfx::Rect& restored_bounds) OVERRIDE; |
| 87 virtual bool IsVisible() const OVERRIDE; | 79 virtual bool IsVisible() const OVERRIDE; |
| 88 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 80 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 89 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; | 81 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; |
| 90 virtual void GetWindowPlacement( | 82 virtual void GetWindowPlacement( |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Local flag for fullscreen state to avoid a state mismatch between | 223 // Local flag for fullscreen state to avoid a state mismatch between |
| 232 // server and local window_properties_ during app-initiated fullscreen. | 224 // server and local window_properties_ during app-initiated fullscreen. |
| 233 bool is_fullscreen_; | 225 bool is_fullscreen_; |
| 234 | 226 |
| 235 // True if the window should stay on top of most other windows. | 227 // True if the window should stay on top of most other windows. |
| 236 bool is_always_on_top_; | 228 bool is_always_on_top_; |
| 237 | 229 |
| 238 // We are owned by the RootWindow, but we have to have a back pointer to it. | 230 // We are owned by the RootWindow, but we have to have a back pointer to it. |
| 239 aura::RootWindow* root_window_; | 231 aura::RootWindow* root_window_; |
| 240 | 232 |
| 241 // aura:: objects that we own. | |
| 242 scoped_ptr<aura::client::FocusClient> focus_client_; | |
| 243 scoped_ptr<views::corewm::CursorManager> cursor_client_; | |
| 244 scoped_ptr<DesktopDispatcherClient> dispatcher_client_; | 233 scoped_ptr<DesktopDispatcherClient> dispatcher_client_; |
| 245 scoped_ptr<aura::client::ScreenPositionClient> position_client_; | 234 |
| 246 scoped_ptr<DesktopDragDropClientAuraX11> drag_drop_client_; | 235 DesktopDragDropClientAuraX11* drag_drop_client_; |
| 247 | 236 |
| 248 // Current Aura cursor. | 237 // Current Aura cursor. |
| 249 gfx::NativeCursor current_cursor_; | 238 gfx::NativeCursor current_cursor_; |
| 250 | 239 |
| 251 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; | 240 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; |
| 252 scoped_ptr<X11DesktopWindowMoveClient> x11_window_move_client_; | 241 scoped_ptr<X11DesktopWindowMoveClient> x11_window_move_client_; |
| 253 | 242 |
| 254 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura | 243 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura |
| 255 // instead of providing this route back to Widget. | 244 // instead of providing this route back to Widget. |
| 256 internal::NativeWidgetDelegate* native_widget_delegate_; | 245 internal::NativeWidgetDelegate* native_widget_delegate_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 272 // A list of all (top-level) windows that have been created but not yet | 261 // A list of all (top-level) windows that have been created but not yet |
| 273 // destroyed. | 262 // destroyed. |
| 274 static std::list<XID>* open_windows_; | 263 static std::list<XID>* open_windows_; |
| 275 | 264 |
| 276 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostX11); | 265 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostX11); |
| 277 }; | 266 }; |
| 278 | 267 |
| 279 } // namespace views | 268 } // namespace views |
| 280 | 269 |
| 281 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ | 270 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_X11_H_ |
| OLD | NEW |