Index: ui/views/widget/desktop_aura/desktop_screen_x11.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc |
index ed8a0f4844cd7f002c6d1c492eff05575ebedf81..2f62f3eff3c70dc509ac7df84952d3167777f0c9 100644 |
--- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc |
+++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc |
@@ -20,6 +20,8 @@ |
#include "ui/display/util/x11/edid_parser_x11.h" |
#include "ui/events/platform/platform_event_source.h" |
#include "ui/gfx/display.h" |
+#include "ui/gfx/geometry/point_conversions.h" |
+#include "ui/gfx/geometry/size_conversions.h" |
#include "ui/gfx/native_widget_types.h" |
#include "ui/gfx/screen.h" |
#include "ui/gfx/x/x11_types.h" |
@@ -267,11 +269,11 @@ std::vector<gfx::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() { |
} |
bool has_work_area = false; |
- gfx::Rect work_area; |
+ gfx::Rect work_area_in_pixels; |
std::vector<int> value; |
if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) && |
value.size() >= 4) { |
- work_area = gfx::Rect(value[0], value[1], value[2], value[3]); |
+ work_area_in_pixels = gfx::Rect(value[0], value[1], value[2], value[3]); |
has_work_area = true; |
} |
@@ -315,9 +317,17 @@ std::vector<gfx::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() { |
} |
if (has_work_area) { |
- gfx::Rect intersection = crtc_bounds; |
- intersection.Intersect(work_area); |
- display.set_work_area(intersection); |
+ gfx::Rect intersection_in_pixels = crtc_bounds; |
+ intersection_in_pixels.Intersect(work_area_in_pixels); |
+ // SetScaleAndBounds() above does the conversion from pixels to DIP for |
+ // us, but set_work_area does not, so we need to do it here. |
+ display.set_work_area(gfx::Rect( |
+ gfx::ToFlooredPoint( |
+ gfx::ScalePoint(intersection_in_pixels.origin(), |
+ 1.0f / display.device_scale_factor())), |
+ gfx::ToFlooredSize( |
+ gfx::ScaleSize(intersection_in_pixels.size(), |
+ 1.0f / display.device_scale_factor())))); |
} |
switch (crtc->rotation) { |