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 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h" |
6 | 6 |
7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 drag_drop_client_(NULL), | 135 drag_drop_client_(NULL), |
136 current_cursor_(ui::kCursorNull), | 136 current_cursor_(ui::kCursorNull), |
137 native_widget_delegate_(native_widget_delegate), | 137 native_widget_delegate_(native_widget_delegate), |
138 desktop_native_widget_aura_(desktop_native_widget_aura), | 138 desktop_native_widget_aura_(desktop_native_widget_aura), |
139 content_window_(NULL), | 139 content_window_(NULL), |
140 window_parent_(NULL), | 140 window_parent_(NULL), |
141 custom_window_shape_(NULL) { | 141 custom_window_shape_(NULL) { |
142 } | 142 } |
143 | 143 |
144 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { | 144 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { |
145 DestroyCompositor(); | |
146 root_window_->window()->ClearProperty(kHostForRootWindow); | 145 root_window_->window()->ClearProperty(kHostForRootWindow); |
147 aura::client::SetWindowMoveClient(root_window_->window(), NULL); | 146 aura::client::SetWindowMoveClient(root_window_->window(), NULL); |
148 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(root_window_); | 147 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(root_window_); |
149 if (custom_window_shape_) | 148 if (custom_window_shape_) |
150 XDestroyRegion(custom_window_shape_); | 149 XDestroyRegion(custom_window_shape_); |
151 } | 150 } |
152 | 151 |
153 // static | 152 // static |
154 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { | 153 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { |
155 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(xid); | 154 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(xid); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 if (window_parent_) { | 312 if (window_parent_) { |
314 window_parent_->window_children_.erase(this); | 313 window_parent_->window_children_.erase(this); |
315 window_parent_ = NULL; | 314 window_parent_ = NULL; |
316 } | 315 } |
317 | 316 |
318 // Remove the event listeners we've installed. We need to remove these | 317 // Remove the event listeners we've installed. We need to remove these |
319 // because otherwise we get assert during ~RootWindow(). | 318 // because otherwise we get assert during ~RootWindow(). |
320 desktop_native_widget_aura_->root_window_event_filter()->RemoveHandler( | 319 desktop_native_widget_aura_->root_window_event_filter()->RemoveHandler( |
321 x11_window_event_filter_.get()); | 320 x11_window_event_filter_.get()); |
322 | 321 |
322 // Destroy the compositor before destroying the |xwindow_|. | |
sky
2014/01/13 23:51:29
nit: documenting what the code does isn't helpful
danakj
2014/01/13 23:54:39
Good point, done.
| |
323 DestroyCompositor(); | |
Ben Goodger (Google)
2014/01/13 23:11:47
So, I wonder if we should do this on windows too.
danakj
2014/01/13 23:54:39
It seems that when the compositor shuts down and t
| |
324 | |
323 open_windows().remove(xwindow_); | 325 open_windows().remove(xwindow_); |
324 // Actually free our native resources. | 326 // Actually free our native resources. |
325 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); | 327 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); |
326 XDestroyWindow(xdisplay_, xwindow_); | 328 XDestroyWindow(xdisplay_, xwindow_); |
327 xwindow_ = None; | 329 xwindow_ = None; |
328 | 330 |
329 desktop_native_widget_aura_->OnHostClosed(); | 331 desktop_native_widget_aura_->OnHostClosed(); |
330 } | 332 } |
331 | 333 |
332 aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { | 334 aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1546 if (linux_ui) { | 1548 if (linux_ui) { |
1547 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1549 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
1548 if (native_theme) | 1550 if (native_theme) |
1549 return native_theme; | 1551 return native_theme; |
1550 } | 1552 } |
1551 | 1553 |
1552 return ui::NativeTheme::instance(); | 1554 return ui::NativeTheme::instance(); |
1553 } | 1555 } |
1554 | 1556 |
1555 } // namespace views | 1557 } // namespace views |
OLD | NEW |