| 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_| since shutdown |
| 323 // may try to swap, and the swap without a window causes an X error, which |
| 324 // causes a crash with in-process renderer. |
| 325 DestroyCompositor(); |
| 326 |
| 323 open_windows().remove(xwindow_); | 327 open_windows().remove(xwindow_); |
| 324 // Actually free our native resources. | 328 // Actually free our native resources. |
| 325 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); | 329 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); |
| 326 XDestroyWindow(xdisplay_, xwindow_); | 330 XDestroyWindow(xdisplay_, xwindow_); |
| 327 xwindow_ = None; | 331 xwindow_ = None; |
| 328 | 332 |
| 329 desktop_native_widget_aura_->OnHostClosed(); | 333 desktop_native_widget_aura_->OnHostClosed(); |
| 330 } | 334 } |
| 331 | 335 |
| 332 aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { | 336 aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 if (linux_ui) { | 1550 if (linux_ui) { |
| 1547 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1551 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 1548 if (native_theme) | 1552 if (native_theme) |
| 1549 return native_theme; | 1553 return native_theme; |
| 1550 } | 1554 } |
| 1551 | 1555 |
| 1552 return ui::NativeTheme::instance(); | 1556 return ui::NativeTheme::instance(); |
| 1553 } | 1557 } |
| 1554 | 1558 |
| 1555 } // namespace views | 1559 } // namespace views |
| OLD | NEW |