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/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xregion.h> | 8 #include <X11/Xregion.h> |
9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 } | 933 } |
934 | 934 |
935 void DesktopWindowTreeHostX11::SizeConstraintsChanged() { | 935 void DesktopWindowTreeHostX11::SizeConstraintsChanged() { |
936 UpdateMinAndMaxSize(); | 936 UpdateMinAndMaxSize(); |
937 } | 937 } |
938 | 938 |
939 //////////////////////////////////////////////////////////////////////////////// | 939 //////////////////////////////////////////////////////////////////////////////// |
940 // DesktopWindowTreeHostX11, aura::WindowTreeHost implementation: | 940 // DesktopWindowTreeHostX11, aura::WindowTreeHost implementation: |
941 | 941 |
942 gfx::Transform DesktopWindowTreeHostX11::GetRootTransform() const { | 942 gfx::Transform DesktopWindowTreeHostX11::GetRootTransform() const { |
943 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 943 gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); |
944 if (window_mapped_) { | 944 if (window_mapped_) { |
945 aura::Window* win = const_cast<aura::Window*>(window()); | 945 aura::Window* win = const_cast<aura::Window*>(window()); |
946 display = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(win); | 946 display = gfx::Screen::GetScreen()->GetDisplayNearestWindow(win); |
947 } | 947 } |
948 | 948 |
949 float scale = display.device_scale_factor(); | 949 float scale = display.device_scale_factor(); |
950 gfx::Transform transform; | 950 gfx::Transform transform; |
951 transform.Scale(scale, scale); | 951 transform.Scale(scale, scale); |
952 return transform; | 952 return transform; |
953 } | 953 } |
954 | 954 |
955 ui::EventSource* DesktopWindowTreeHostX11::GetEventSource() { | 955 ui::EventSource* DesktopWindowTreeHostX11::GetEventSource() { |
956 return this; | 956 return this; |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) { | 1529 void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) { |
1530 if (native_widget_delegate_->AsWidget()->IsActive()) | 1530 if (native_widget_delegate_->AsWidget()->IsActive()) |
1531 GetInputMethod()->DispatchKeyEvent(event); | 1531 GetInputMethod()->DispatchKeyEvent(event); |
1532 } | 1532 } |
1533 | 1533 |
1534 void DesktopWindowTreeHostX11::ConvertEventToDifferentHost( | 1534 void DesktopWindowTreeHostX11::ConvertEventToDifferentHost( |
1535 ui::LocatedEvent* located_event, | 1535 ui::LocatedEvent* located_event, |
1536 DesktopWindowTreeHostX11* host) { | 1536 DesktopWindowTreeHostX11* host) { |
1537 DCHECK_NE(this, host); | 1537 DCHECK_NE(this, host); |
1538 const gfx::Display display_src = | 1538 const gfx::Display display_src = |
1539 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(window()); | 1539 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
1540 const gfx::Display display_dest = | 1540 const gfx::Display display_dest = |
1541 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(host->window()); | 1541 gfx::Screen::GetScreen()->GetDisplayNearestWindow(host->window()); |
1542 DCHECK_EQ(display_src.device_scale_factor(), | 1542 DCHECK_EQ(display_src.device_scale_factor(), |
1543 display_dest.device_scale_factor()); | 1543 display_dest.device_scale_factor()); |
1544 gfx::Vector2d offset = GetLocationOnNativeScreen() - | 1544 gfx::Vector2d offset = GetLocationOnNativeScreen() - |
1545 host->GetLocationOnNativeScreen(); | 1545 host->GetLocationOnNativeScreen(); |
1546 gfx::PointF location_in_pixel_in_host = | 1546 gfx::PointF location_in_pixel_in_host = |
1547 located_event->location_f() + gfx::Vector2dF(offset); | 1547 located_event->location_f() + gfx::Vector2dF(offset); |
1548 located_event->set_location_f(location_in_pixel_in_host); | 1548 located_event->set_location_f(location_in_pixel_in_host); |
1549 } | 1549 } |
1550 | 1550 |
1551 void DesktopWindowTreeHostX11::ResetWindowRegion() { | 1551 void DesktopWindowTreeHostX11::ResetWindowRegion() { |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 if (linux_ui) { | 2058 if (linux_ui) { |
2059 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2059 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
2060 if (native_theme) | 2060 if (native_theme) |
2061 return native_theme; | 2061 return native_theme; |
2062 } | 2062 } |
2063 | 2063 |
2064 return ui::NativeThemeAura::instance(); | 2064 return ui::NativeThemeAura::instance(); |
2065 } | 2065 } |
2066 | 2066 |
2067 } // namespace views | 2067 } // namespace views |
OLD | NEW |