| 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_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/shape.h> |
| 8 #include <X11/extensions/XInput2.h> |
| 7 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 8 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
| 9 #include <X11/Xutil.h> | 11 #include <X11/Xutil.h> |
| 10 #include <X11/extensions/XInput2.h> | |
| 11 #include <X11/extensions/shape.h> | |
| 12 | 12 |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/location.h" |
| 16 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 21 #include "third_party/skia/include/core/SkPath.h" | 24 #include "third_party/skia/include/core/SkPath.h" |
| 22 #include "ui/aura/client/cursor_client.h" | 25 #include "ui/aura/client/cursor_client.h" |
| 23 #include "ui/aura/client/focus_client.h" | 26 #include "ui/aura/client/focus_client.h" |
| 24 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_event_dispatcher.h" | 28 #include "ui/aura/window_event_dispatcher.h" |
| 26 #include "ui/aura/window_property.h" | 29 #include "ui/aura/window_property.h" |
| 27 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" | 30 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
| 28 #include "ui/base/hit_test.h" | 31 #include "ui/base/hit_test.h" |
| 29 #include "ui/base/ime/input_method.h" | 32 #include "ui/base/ime/input_method.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 340 |
| 338 void DesktopWindowTreeHostX11::Close() { | 341 void DesktopWindowTreeHostX11::Close() { |
| 339 // TODO(erg): Might need to do additional hiding tasks here. | 342 // TODO(erg): Might need to do additional hiding tasks here. |
| 340 delayed_resize_task_.Cancel(); | 343 delayed_resize_task_.Cancel(); |
| 341 | 344 |
| 342 if (!close_widget_factory_.HasWeakPtrs()) { | 345 if (!close_widget_factory_.HasWeakPtrs()) { |
| 343 // And we delay the close so that if we are called from an ATL callback, | 346 // And we delay the close so that if we are called from an ATL callback, |
| 344 // we don't destroy the window before the callback returned (as the caller | 347 // we don't destroy the window before the callback returned (as the caller |
| 345 // may delete ourselves on destroy and the ATL callback would still | 348 // may delete ourselves on destroy and the ATL callback would still |
| 346 // dereference us when the callback returns). | 349 // dereference us when the callback returns). |
| 347 base::MessageLoop::current()->PostTask( | 350 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 348 FROM_HERE, | 351 FROM_HERE, base::Bind(&DesktopWindowTreeHostX11::CloseNow, |
| 349 base::Bind(&DesktopWindowTreeHostX11::CloseNow, | 352 close_widget_factory_.GetWeakPtr())); |
| 350 close_widget_factory_.GetWeakPtr())); | |
| 351 } | 353 } |
| 352 } | 354 } |
| 353 | 355 |
| 354 void DesktopWindowTreeHostX11::CloseNow() { | 356 void DesktopWindowTreeHostX11::CloseNow() { |
| 355 if (xwindow_ == None) | 357 if (xwindow_ == None) |
| 356 return; | 358 return; |
| 357 | 359 |
| 358 ReleaseCapture(); | 360 ReleaseCapture(); |
| 359 native_widget_delegate_->OnNativeWidgetDestroying(); | 361 native_widget_delegate_->OnNativeWidgetDestroying(); |
| 360 | 362 |
| (...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 previous_bounds_in_pixels_ = bounds_in_pixels_; | 1807 previous_bounds_in_pixels_ = bounds_in_pixels_; |
| 1806 bounds_in_pixels_ = bounds_in_pixels; | 1808 bounds_in_pixels_ = bounds_in_pixels; |
| 1807 | 1809 |
| 1808 if (origin_changed) | 1810 if (origin_changed) |
| 1809 OnHostMoved(bounds_in_pixels_.origin()); | 1811 OnHostMoved(bounds_in_pixels_.origin()); |
| 1810 | 1812 |
| 1811 if (size_changed) { | 1813 if (size_changed) { |
| 1812 delayed_resize_task_.Reset(base::Bind( | 1814 delayed_resize_task_.Reset(base::Bind( |
| 1813 &DesktopWindowTreeHostX11::DelayedResize, | 1815 &DesktopWindowTreeHostX11::DelayedResize, |
| 1814 close_widget_factory_.GetWeakPtr(), bounds_in_pixels.size())); | 1816 close_widget_factory_.GetWeakPtr(), bounds_in_pixels.size())); |
| 1815 base::MessageLoop::current()->PostTask( | 1817 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1816 FROM_HERE, delayed_resize_task_.callback()); | 1818 FROM_HERE, delayed_resize_task_.callback()); |
| 1817 } | 1819 } |
| 1818 break; | 1820 break; |
| 1819 } | 1821 } |
| 1820 case GenericEvent: { | 1822 case GenericEvent: { |
| 1821 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 1823 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
| 1822 if (!factory->ShouldProcessXI2Event(xev)) | 1824 if (!factory->ShouldProcessXI2Event(xev)) |
| 1823 break; | 1825 break; |
| 1824 | 1826 |
| 1825 ui::EventType type = ui::EventTypeFromNative(xev); | 1827 ui::EventType type = ui::EventTypeFromNative(xev); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 if (linux_ui) { | 2055 if (linux_ui) { |
| 2054 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2056 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 2055 if (native_theme) | 2057 if (native_theme) |
| 2056 return native_theme; | 2058 return native_theme; |
| 2057 } | 2059 } |
| 2058 | 2060 |
| 2059 return ui::NativeThemeAura::instance(); | 2061 return ui::NativeThemeAura::instance(); |
| 2060 } | 2062 } |
| 2061 | 2063 |
| 2062 } // namespace views | 2064 } // namespace views |
| OLD | NEW |