| 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> | 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 12 matching lines...) Expand all Loading... |
| 23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 24 #include "third_party/skia/include/core/SkPath.h" | 24 #include "third_party/skia/include/core/SkPath.h" |
| 25 #include "ui/aura/client/cursor_client.h" | 25 #include "ui/aura/client/cursor_client.h" |
| 26 #include "ui/aura/client/focus_client.h" | 26 #include "ui/aura/client/focus_client.h" |
| 27 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
| 28 #include "ui/aura/window_event_dispatcher.h" | 28 #include "ui/aura/window_event_dispatcher.h" |
| 29 #include "ui/base/class_property.h" | 29 #include "ui/base/class_property.h" |
| 30 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" | 30 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
| 31 #include "ui/base/hit_test.h" | 31 #include "ui/base/hit_test.h" |
| 32 #include "ui/base/ime/input_method.h" | 32 #include "ui/base/ime/input_method.h" |
| 33 #include "ui/base/layout.h" |
| 33 #include "ui/base/x/x11_util.h" | 34 #include "ui/base/x/x11_util.h" |
| 34 #include "ui/base/x/x11_util_internal.h" | 35 #include "ui/base/x/x11_util_internal.h" |
| 35 #include "ui/base/x/x11_window_event_manager.h" | 36 #include "ui/base/x/x11_window_event_manager.h" |
| 36 #include "ui/display/display.h" | |
| 37 #include "ui/display/screen.h" | 37 #include "ui/display/screen.h" |
| 38 #include "ui/events/devices/x11/device_data_manager_x11.h" | 38 #include "ui/events/devices/x11/device_data_manager_x11.h" |
| 39 #include "ui/events/devices/x11/device_list_cache_x11.h" | 39 #include "ui/events/devices/x11/device_list_cache_x11.h" |
| 40 #include "ui/events/devices/x11/touch_factory_x11.h" | 40 #include "ui/events/devices/x11/touch_factory_x11.h" |
| 41 #include "ui/events/event_utils.h" | 41 #include "ui/events/event_utils.h" |
| 42 #include "ui/events/null_event_targeter.h" | 42 #include "ui/events/null_event_targeter.h" |
| 43 #include "ui/events/platform/platform_event_source.h" | 43 #include "ui/events/platform/platform_event_source.h" |
| 44 #include "ui/events/platform/x11/x11_event_source.h" | 44 #include "ui/events/platform/x11/x11_event_source.h" |
| 45 #include "ui/gfx/geometry/insets.h" | 45 #include "ui/gfx/geometry/insets.h" |
| 46 #include "ui/gfx/geometry/size_conversions.h" | 46 #include "ui/gfx/geometry/size_conversions.h" |
| (...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1808 | 1808 |
| 1809 void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) { | 1809 void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) { |
| 1810 if (native_widget_delegate_->AsWidget()->IsActive()) | 1810 if (native_widget_delegate_->AsWidget()->IsActive()) |
| 1811 GetInputMethod()->DispatchKeyEvent(event); | 1811 GetInputMethod()->DispatchKeyEvent(event); |
| 1812 } | 1812 } |
| 1813 | 1813 |
| 1814 void DesktopWindowTreeHostX11::ConvertEventToDifferentHost( | 1814 void DesktopWindowTreeHostX11::ConvertEventToDifferentHost( |
| 1815 ui::LocatedEvent* located_event, | 1815 ui::LocatedEvent* located_event, |
| 1816 DesktopWindowTreeHostX11* host) { | 1816 DesktopWindowTreeHostX11* host) { |
| 1817 DCHECK_NE(this, host); | 1817 DCHECK_NE(this, host); |
| 1818 const display::Display display_src = | 1818 DCHECK_EQ(ui::GetScaleFactorForNativeView(window()), |
| 1819 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 1819 ui::GetScaleFactorForNativeView(host->window())); |
| 1820 const display::Display display_dest = | |
| 1821 display::Screen::GetScreen()->GetDisplayNearestWindow(host->window()); | |
| 1822 DCHECK_EQ(display_src.device_scale_factor(), | |
| 1823 display_dest.device_scale_factor()); | |
| 1824 gfx::Vector2d offset = | 1820 gfx::Vector2d offset = |
| 1825 GetLocationOnScreenInPixels() - host->GetLocationOnScreenInPixels(); | 1821 GetLocationOnScreenInPixels() - host->GetLocationOnScreenInPixels(); |
| 1826 gfx::PointF location_in_pixel_in_host = | 1822 gfx::PointF location_in_pixel_in_host = |
| 1827 located_event->location_f() + gfx::Vector2dF(offset); | 1823 located_event->location_f() + gfx::Vector2dF(offset); |
| 1828 located_event->set_location_f(location_in_pixel_in_host); | 1824 located_event->set_location_f(location_in_pixel_in_host); |
| 1829 located_event->set_root_location_f(location_in_pixel_in_host); | 1825 located_event->set_root_location_f(location_in_pixel_in_host); |
| 1830 } | 1826 } |
| 1831 | 1827 |
| 1832 void DesktopWindowTreeHostX11::ResetWindowRegion() { | 1828 void DesktopWindowTreeHostX11::ResetWindowRegion() { |
| 1833 // If a custom window shape was supplied then apply it. | 1829 // If a custom window shape was supplied then apply it. |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 | 2361 |
| 2366 // static | 2362 // static |
| 2367 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2363 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 2368 internal::NativeWidgetDelegate* native_widget_delegate, | 2364 internal::NativeWidgetDelegate* native_widget_delegate, |
| 2369 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2365 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 2370 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2366 return new DesktopWindowTreeHostX11(native_widget_delegate, |
| 2371 desktop_native_widget_aura); | 2367 desktop_native_widget_aura); |
| 2372 } | 2368 } |
| 2373 | 2369 |
| 2374 } // namespace views | 2370 } // namespace views |
| OLD | NEW |