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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 class VIEWS_EXPORT DesktopWindowTreeHostX11 | 42 class VIEWS_EXPORT DesktopWindowTreeHostX11 |
43 : public DesktopWindowTreeHost, | 43 : public DesktopWindowTreeHost, |
44 public aura::WindowTreeHost, | 44 public aura::WindowTreeHost, |
45 public ui::EventSource, | 45 public ui::EventSource, |
46 public ui::PlatformEventDispatcher { | 46 public ui::PlatformEventDispatcher { |
47 public: | 47 public: |
48 DesktopWindowTreeHostX11( | 48 DesktopWindowTreeHostX11( |
49 internal::NativeWidgetDelegate* native_widget_delegate, | 49 internal::NativeWidgetDelegate* native_widget_delegate, |
50 DesktopNativeWidgetAura* desktop_native_widget_aura); | 50 DesktopNativeWidgetAura* desktop_native_widget_aura); |
51 virtual ~DesktopWindowTreeHostX11(); | 51 ~DesktopWindowTreeHostX11() override; |
52 | 52 |
53 // A way of converting an X11 |xid| host window into a |content_window_|. | 53 // A way of converting an X11 |xid| host window into a |content_window_|. |
54 static aura::Window* GetContentWindowForXID(XID xid); | 54 static aura::Window* GetContentWindowForXID(XID xid); |
55 | 55 |
56 // A way of converting an X11 |xid| host window into this object. | 56 // A way of converting an X11 |xid| host window into this object. |
57 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); | 57 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); |
58 | 58 |
59 // Get all open top-level windows. This includes windows that may not be | 59 // Get all open top-level windows. This includes windows that may not be |
60 // visible. This list is sorted in their stacking order, i.e. the first window | 60 // visible. This list is sorted in their stacking order, i.e. the first window |
61 // is the topmost window. | 61 // is the topmost window. |
(...skipping 18 matching lines...) Expand all Loading... |
80 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); | 80 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); |
81 | 81 |
82 // Swaps the current handler for events in the non client view with |handler|. | 82 // Swaps the current handler for events in the non client view with |handler|. |
83 void SwapNonClientEventHandler(scoped_ptr<ui::EventHandler> handler); | 83 void SwapNonClientEventHandler(scoped_ptr<ui::EventHandler> handler); |
84 | 84 |
85 // Deallocates the internal list of open windows. | 85 // Deallocates the internal list of open windows. |
86 static void CleanUpWindowList(); | 86 static void CleanUpWindowList(); |
87 | 87 |
88 protected: | 88 protected: |
89 // Overridden from DesktopWindowTreeHost: | 89 // Overridden from DesktopWindowTreeHost: |
90 virtual void Init(aura::Window* content_window, | 90 void Init(aura::Window* content_window, |
91 const Widget::InitParams& params) override; | 91 const Widget::InitParams& params) override; |
92 virtual void OnNativeWidgetCreated(const Widget::InitParams& params) override; | 92 void OnNativeWidgetCreated(const Widget::InitParams& params) override; |
93 virtual scoped_ptr<corewm::Tooltip> CreateTooltip() override; | 93 scoped_ptr<corewm::Tooltip> CreateTooltip() override; |
94 virtual scoped_ptr<aura::client::DragDropClient> | 94 scoped_ptr<aura::client::DragDropClient> CreateDragDropClient( |
95 CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) override; | 95 DesktopNativeCursorManager* cursor_manager) override; |
96 virtual void Close() override; | 96 void Close() override; |
97 virtual void CloseNow() override; | 97 void CloseNow() override; |
98 virtual aura::WindowTreeHost* AsWindowTreeHost() override; | 98 aura::WindowTreeHost* AsWindowTreeHost() override; |
99 virtual void ShowWindowWithState(ui::WindowShowState show_state) override; | 99 void ShowWindowWithState(ui::WindowShowState show_state) override; |
100 virtual void ShowMaximizedWithBounds( | 100 void ShowMaximizedWithBounds(const gfx::Rect& restored_bounds) override; |
101 const gfx::Rect& restored_bounds) override; | 101 bool IsVisible() const override; |
102 virtual bool IsVisible() const override; | 102 void SetSize(const gfx::Size& requested_size) override; |
103 virtual void SetSize(const gfx::Size& requested_size) override; | 103 void StackAtTop() override; |
104 virtual void StackAtTop() override; | 104 void CenterWindow(const gfx::Size& size) override; |
105 virtual void CenterWindow(const gfx::Size& size) override; | 105 void GetWindowPlacement(gfx::Rect* bounds, |
106 virtual void GetWindowPlacement( | 106 ui::WindowShowState* show_state) const override; |
107 gfx::Rect* bounds, | 107 gfx::Rect GetWindowBoundsInScreen() const override; |
108 ui::WindowShowState* show_state) const override; | 108 gfx::Rect GetClientAreaBoundsInScreen() const override; |
109 virtual gfx::Rect GetWindowBoundsInScreen() const override; | 109 gfx::Rect GetRestoredBounds() const override; |
110 virtual gfx::Rect GetClientAreaBoundsInScreen() const override; | 110 gfx::Rect GetWorkAreaBoundsInScreen() const override; |
111 virtual gfx::Rect GetRestoredBounds() const override; | 111 void SetShape(gfx::NativeRegion native_region) override; |
112 virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; | 112 void Activate() override; |
113 virtual void SetShape(gfx::NativeRegion native_region) override; | 113 void Deactivate() override; |
114 virtual void Activate() override; | 114 bool IsActive() const override; |
115 virtual void Deactivate() override; | 115 void Maximize() override; |
116 virtual bool IsActive() const override; | 116 void Minimize() override; |
117 virtual void Maximize() override; | 117 void Restore() override; |
118 virtual void Minimize() override; | 118 bool IsMaximized() const override; |
119 virtual void Restore() override; | 119 bool IsMinimized() const override; |
120 virtual bool IsMaximized() const override; | 120 bool HasCapture() const override; |
121 virtual bool IsMinimized() const override; | 121 void SetAlwaysOnTop(bool always_on_top) override; |
122 virtual bool HasCapture() const override; | 122 bool IsAlwaysOnTop() const override; |
123 virtual void SetAlwaysOnTop(bool always_on_top) override; | 123 void SetVisibleOnAllWorkspaces(bool always_visible) override; |
124 virtual bool IsAlwaysOnTop() const override; | 124 bool SetWindowTitle(const base::string16& title) override; |
125 virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; | 125 void ClearNativeFocus() override; |
126 virtual bool SetWindowTitle(const base::string16& title) override; | 126 Widget::MoveLoopResult RunMoveLoop( |
127 virtual void ClearNativeFocus() override; | |
128 virtual Widget::MoveLoopResult RunMoveLoop( | |
129 const gfx::Vector2d& drag_offset, | 127 const gfx::Vector2d& drag_offset, |
130 Widget::MoveLoopSource source, | 128 Widget::MoveLoopSource source, |
131 Widget::MoveLoopEscapeBehavior escape_behavior) override; | 129 Widget::MoveLoopEscapeBehavior escape_behavior) override; |
132 virtual void EndMoveLoop() override; | 130 void EndMoveLoop() override; |
133 virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; | 131 void SetVisibilityChangedAnimationsEnabled(bool value) override; |
134 virtual bool ShouldUseNativeFrame() const override; | 132 bool ShouldUseNativeFrame() const override; |
135 virtual bool ShouldWindowContentsBeTransparent() const override; | 133 bool ShouldWindowContentsBeTransparent() const override; |
136 virtual void FrameTypeChanged() override; | 134 void FrameTypeChanged() override; |
137 virtual void SetFullscreen(bool fullscreen) override; | 135 void SetFullscreen(bool fullscreen) override; |
138 virtual bool IsFullscreen() const override; | 136 bool IsFullscreen() const override; |
139 virtual void SetOpacity(unsigned char opacity) override; | 137 void SetOpacity(unsigned char opacity) override; |
140 virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, | 138 void SetWindowIcons(const gfx::ImageSkia& window_icon, |
141 const gfx::ImageSkia& app_icon) override; | 139 const gfx::ImageSkia& app_icon) override; |
142 virtual void InitModalType(ui::ModalType modal_type) override; | 140 void InitModalType(ui::ModalType modal_type) override; |
143 virtual void FlashFrame(bool flash_frame) override; | 141 void FlashFrame(bool flash_frame) override; |
144 virtual void OnRootViewLayout() override; | 142 void OnRootViewLayout() override; |
145 virtual void OnNativeWidgetFocus() override; | 143 void OnNativeWidgetFocus() override; |
146 virtual void OnNativeWidgetBlur() override; | 144 void OnNativeWidgetBlur() override; |
147 virtual bool IsAnimatingClosed() const override; | 145 bool IsAnimatingClosed() const override; |
148 virtual bool IsTranslucentWindowOpacitySupported() const override; | 146 bool IsTranslucentWindowOpacitySupported() const override; |
149 virtual void SizeConstraintsChanged() override; | 147 void SizeConstraintsChanged() override; |
150 | 148 |
151 // Overridden from aura::WindowTreeHost: | 149 // Overridden from aura::WindowTreeHost: |
152 virtual ui::EventSource* GetEventSource() override; | 150 ui::EventSource* GetEventSource() override; |
153 virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; | 151 gfx::AcceleratedWidget GetAcceleratedWidget() override; |
154 virtual void Show() override; | 152 void Show() override; |
155 virtual void Hide() override; | 153 void Hide() override; |
156 virtual gfx::Rect GetBounds() const override; | 154 gfx::Rect GetBounds() const override; |
157 virtual void SetBounds(const gfx::Rect& requested_bounds) override; | 155 void SetBounds(const gfx::Rect& requested_bounds) override; |
158 virtual gfx::Point GetLocationOnNativeScreen() const override; | 156 gfx::Point GetLocationOnNativeScreen() const override; |
159 virtual void SetCapture() override; | 157 void SetCapture() override; |
160 virtual void ReleaseCapture() override; | 158 void ReleaseCapture() override; |
161 virtual void PostNativeEvent(const base::NativeEvent& native_event) override; | 159 void PostNativeEvent(const base::NativeEvent& native_event) override; |
162 virtual void SetCursorNative(gfx::NativeCursor cursor) override; | 160 void SetCursorNative(gfx::NativeCursor cursor) override; |
163 virtual void MoveCursorToNative(const gfx::Point& location) override; | 161 void MoveCursorToNative(const gfx::Point& location) override; |
164 virtual void OnCursorVisibilityChangedNative(bool show) override; | 162 void OnCursorVisibilityChangedNative(bool show) override; |
165 | 163 |
166 // Overridden frm ui::EventSource | 164 // Overridden frm ui::EventSource |
167 virtual ui::EventProcessor* GetEventProcessor() override; | 165 ui::EventProcessor* GetEventProcessor() override; |
168 | 166 |
169 private: | 167 private: |
170 // Initializes our X11 surface to draw on. This method performs all | 168 // Initializes our X11 surface to draw on. This method performs all |
171 // initialization related to talking to the X11 server. | 169 // initialization related to talking to the X11 server. |
172 void InitX11Window(const Widget::InitParams& params); | 170 void InitX11Window(const Widget::InitParams& params); |
173 | 171 |
174 // Creates an aura::WindowEventDispatcher to contain the |content_window|, | 172 // Creates an aura::WindowEventDispatcher to contain the |content_window|, |
175 // along with all aura client objects that direct behavior. | 173 // along with all aura client objects that direct behavior. |
176 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params); | 174 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params); |
177 | 175 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 226 |
229 // Map the window (shows it) taking into account the given |show_state|. | 227 // Map the window (shows it) taking into account the given |show_state|. |
230 void MapWindow(ui::WindowShowState show_state); | 228 void MapWindow(ui::WindowShowState show_state); |
231 | 229 |
232 void SetWindowTransparency(); | 230 void SetWindowTransparency(); |
233 | 231 |
234 // Relayout the widget's client and non-client views. | 232 // Relayout the widget's client and non-client views. |
235 void Relayout(); | 233 void Relayout(); |
236 | 234 |
237 // ui::PlatformEventDispatcher: | 235 // ui::PlatformEventDispatcher: |
238 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; | 236 bool CanDispatchEvent(const ui::PlatformEvent& event) override; |
239 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; | 237 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; |
240 | 238 |
241 void DelayedResize(const gfx::Size& size); | 239 void DelayedResize(const gfx::Size& size); |
242 | 240 |
243 // X11 things | 241 // X11 things |
244 // The display and the native X window hosting the root window. | 242 // The display and the native X window hosting the root window. |
245 XDisplay* xdisplay_; | 243 XDisplay* xdisplay_; |
246 ::Window xwindow_; | 244 ::Window xwindow_; |
247 | 245 |
248 // The native root window. | 246 // The native root window. |
249 ::Window x_root_window_; | 247 ::Window x_root_window_; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 base::CancelableCallback<void()> delayed_resize_task_; | 337 base::CancelableCallback<void()> delayed_resize_task_; |
340 | 338 |
341 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; | 339 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
342 | 340 |
343 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 341 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
344 }; | 342 }; |
345 | 343 |
346 } // namespace views | 344 } // namespace views |
347 | 345 |
348 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 346 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |