OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/wayland/server.h" | 5 #include "components/exo/wayland/server.h" |
6 | 6 |
7 #include <alpha-compositing-unstable-v1-server-protocol.h> | 7 #include <alpha-compositing-unstable-v1-server-protocol.h> |
8 #include <gaming-input-unstable-v1-server-protocol.h> | 8 #include <gaming-input-unstable-v1-server-protocol.h> |
9 #include <gaming-input-unstable-v2-server-protocol.h> | 9 #include <gaming-input-unstable-v2-server-protocol.h> |
10 #include <grp.h> | 10 #include <grp.h> |
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2120 weak_ptr_factory_.GetWeakPtr()), | 2120 weak_ptr_factory_.GetWeakPtr()), |
2121 base::TimeDelta::FromMilliseconds(delay_ms)); | 2121 base::TimeDelta::FromMilliseconds(delay_ms)); |
2122 } | 2122 } |
2123 | 2123 |
2124 void SendDisplayMetrics() { | 2124 void SendDisplayMetrics() { |
2125 if (!needs_send_display_metrics_) | 2125 if (!needs_send_display_metrics_) |
2126 return; | 2126 return; |
2127 needs_send_display_metrics_ = false; | 2127 needs_send_display_metrics_ = false; |
2128 | 2128 |
2129 const display::Screen* screen = display::Screen::GetScreen(); | 2129 const display::Screen* screen = display::Screen::GetScreen(); |
2130 display::Display primary_display = screen->GetPrimaryDisplay(); | |
2130 | 2131 |
2131 if (IsMultiDisplaySupported()) { | 2132 if (IsMultiDisplaySupported()) { |
2133 // TODO(domlaskowski): Send real DSFs once client selects DPI using DSF. | |
reveman
2017/03/28 07:12:21
I don't understand this TODO. Can you link to a bu
Dominik Laskowski
2017/03/30 01:21:43
Updated comment.
| |
2134 double device_scale_factor = | |
2135 WMHelper::GetInstance() | |
2136 ->GetDisplayInfo(display::Display::HasInternalDisplay() | |
2137 ? display::Display::InternalDisplayId() | |
2138 : primary_display.id()) | |
2139 .device_scale_factor(); | |
oshima
2017/03/28 12:46:55
This value may change (as primary display may chan
Dominik Laskowski
2017/03/30 01:21:44
On a device without an internal display, the curso
| |
2140 | |
2132 for (const auto& display : screen->GetAllDisplays()) { | 2141 for (const auto& display : screen->GetAllDisplays()) { |
2133 const gfx::Rect& bounds = display.bounds(); | 2142 const gfx::Rect& bounds = display.bounds(); |
2134 const gfx::Insets& insets = display.GetWorkAreaInsets(); | 2143 const gfx::Insets& insets = display.GetWorkAreaInsets(); |
2135 | 2144 |
2136 zcr_remote_shell_v1_send_workspace( | 2145 zcr_remote_shell_v1_send_workspace( |
2137 remote_shell_resource_, | 2146 remote_shell_resource_, |
2138 static_cast<uint32_t>(display.id() >> 32), | 2147 static_cast<uint32_t>(display.id() >> 32), |
2139 static_cast<uint32_t>(display.id()), | 2148 static_cast<uint32_t>(display.id()), |
2140 bounds.x(), bounds.y(), bounds.width(), bounds.height(), | 2149 bounds.x(), bounds.y(), bounds.width(), bounds.height(), |
2141 insets.left(), insets.top(), insets.right(), insets.bottom(), | 2150 insets.left(), insets.top(), insets.right(), insets.bottom(), |
2142 OutputTransform(display.rotation()), | 2151 OutputTransform(display.rotation()), |
2143 wl_fixed_from_double(display.device_scale_factor())); | 2152 wl_fixed_from_double(device_scale_factor)); |
2144 } | 2153 } |
2145 | 2154 |
2146 zcr_remote_shell_v1_send_configure(remote_shell_resource_, layout_mode_); | 2155 zcr_remote_shell_v1_send_configure(remote_shell_resource_, layout_mode_); |
2147 } | 2156 } |
2148 | 2157 |
2149 display::Display primary_display = screen->GetPrimaryDisplay(); | |
2150 const gfx::Insets& insets = primary_display.GetWorkAreaInsets(); | 2158 const gfx::Insets& insets = primary_display.GetWorkAreaInsets(); |
2151 | 2159 |
2152 zcr_remote_shell_v1_send_configuration_changed( | 2160 zcr_remote_shell_v1_send_configuration_changed( |
2153 remote_shell_resource_, | 2161 remote_shell_resource_, |
2154 primary_display.size().width(), | 2162 primary_display.size().width(), |
2155 primary_display.size().height(), | 2163 primary_display.size().height(), |
2156 OutputTransform(primary_display.rotation()), | 2164 OutputTransform(primary_display.rotation()), |
2157 wl_fixed_from_double(primary_display.device_scale_factor()), | 2165 wl_fixed_from_double(primary_display.device_scale_factor()), |
2158 insets.left(), insets.top(), insets.right(), insets.bottom(), | 2166 insets.left(), insets.top(), insets.right(), insets.bottom(), |
2159 layout_mode_); | 2167 layout_mode_); |
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3914 DCHECK(event_loop); | 3922 DCHECK(event_loop); |
3915 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3923 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
3916 } | 3924 } |
3917 | 3925 |
3918 void Server::Flush() { | 3926 void Server::Flush() { |
3919 wl_display_flush_clients(wl_display_.get()); | 3927 wl_display_flush_clients(wl_display_.get()); |
3920 } | 3928 } |
3921 | 3929 |
3922 } // namespace wayland | 3930 } // namespace wayland |
3923 } // namespace exo | 3931 } // namespace exo |
OLD | NEW |