Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: ui/views/widget/desktop_aura/desktop_screen_x11.cc

Issue 1036263003: hi-dpi: convert _NET_WORKAREA from pixels. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hi-dpi: convert _NET_WORKAREA from pixels. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698