| 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(); |
| 145 root_window_->window()->ClearProperty(kHostForRootWindow); | 146 root_window_->window()->ClearProperty(kHostForRootWindow); |
| 146 aura::client::SetWindowMoveClient(root_window_->window(), NULL); | 147 aura::client::SetWindowMoveClient(root_window_->window(), NULL); |
| 147 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(root_window_); | 148 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(root_window_); |
| 148 if (custom_window_shape_) | 149 if (custom_window_shape_) |
| 149 XDestroyRegion(custom_window_shape_); | 150 XDestroyRegion(custom_window_shape_); |
| 150 } | 151 } |
| 151 | 152 |
| 152 // static | 153 // static |
| 153 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { | 154 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { |
| 154 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(xid); | 155 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(xid); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 if (window_parent_) { | 313 if (window_parent_) { |
| 313 window_parent_->window_children_.erase(this); | 314 window_parent_->window_children_.erase(this); |
| 314 window_parent_ = NULL; | 315 window_parent_ = NULL; |
| 315 } | 316 } |
| 316 | 317 |
| 317 // Remove the event listeners we've installed. We need to remove these | 318 // Remove the event listeners we've installed. We need to remove these |
| 318 // because otherwise we get assert during ~RootWindow(). | 319 // because otherwise we get assert during ~RootWindow(). |
| 319 desktop_native_widget_aura_->root_window_event_filter()->RemoveHandler( | 320 desktop_native_widget_aura_->root_window_event_filter()->RemoveHandler( |
| 320 x11_window_event_filter_.get()); | 321 x11_window_event_filter_.get()); |
| 321 | 322 |
| 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 | |
| 327 open_windows().remove(xwindow_); | 323 open_windows().remove(xwindow_); |
| 328 // Actually free our native resources. | 324 // Actually free our native resources. |
| 329 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); | 325 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); |
| 330 XDestroyWindow(xdisplay_, xwindow_); | 326 XDestroyWindow(xdisplay_, xwindow_); |
| 331 xwindow_ = None; | 327 xwindow_ = None; |
| 332 | 328 |
| 333 desktop_native_widget_aura_->OnHostClosed(); | 329 desktop_native_widget_aura_->OnHostClosed(); |
| 334 } | 330 } |
| 335 | 331 |
| 336 aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { | 332 aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 if (linux_ui) { | 1576 if (linux_ui) { |
| 1581 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1577 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 1582 if (native_theme) | 1578 if (native_theme) |
| 1583 return native_theme; | 1579 return native_theme; |
| 1584 } | 1580 } |
| 1585 | 1581 |
| 1586 return ui::NativeTheme::instance(); | 1582 return ui::NativeTheme::instance(); |
| 1587 } | 1583 } |
| 1588 | 1584 |
| 1589 } // namespace views | 1585 } // namespace views |
| OLD | NEW |