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

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

Issue 659883002: Enable hidpi on Linux, refactor a bit on Windows to share Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resource bundle loading Created 6 years, 2 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
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 bb253cff17ce48e6295bbee89574a874f5733462..e14b9d7bf07bfce51c97452fbb4d972646f35062 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
@@ -20,6 +20,7 @@
#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/dpi.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/x/x11_types.h"
@@ -33,18 +34,6 @@ namespace {
// in |Dispatch()|.
const int64 kConfigureDelayMs = 500;
-// TODO(oshima): Consider using gtk-xft-dpi instead.
-float GetDeviceScaleFactor(int screen_pixels, int screen_mm) {
- const int kCSSDefaultDPI = 96;
- const float kInchInMm = 25.4f;
-
- float screen_inches = screen_mm / kInchInMm;
- float screen_dpi = screen_pixels / screen_inches;
- float scale = screen_dpi / kCSSDefaultDPI;
-
- return ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactor(scale));
-}
-
std::vector<gfx::Display> GetFallbackDisplayList() {
::XDisplay* display = gfx::GetXDisplay();
::Screen* screen = DefaultScreenOfDisplay(display);
@@ -56,8 +45,7 @@ std::vector<gfx::Display> GetFallbackDisplayList() {
gfx::Display gfx_display(0, bounds_in_pixels);
if (!gfx::Display::HasForceDeviceScaleFactor() &&
!ui::IsDisplaySizeBlackListed(physical_size)) {
- float device_scale_factor = GetDeviceScaleFactor(
- width, physical_size.width());
+ float device_scale_factor = gfx::GetDeviceScaleFactor();
DCHECK_LE(1.0f, device_scale_factor);
gfx_display.SetScaleAndBounds(device_scale_factor, bounds_in_pixels);
}
@@ -279,7 +267,9 @@ std::vector<gfx::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() {
has_work_area = true;
}
+
oshima 2014/10/20 21:11:59 remove extra new line
scottmg 2014/10/22 18:54:14 Done.
float device_scale_factor = 1.0f;
oshima 2014/10/20 21:11:59 isn't it better to initialize this once here?
scottmg 2014/10/22 18:54:14 Done.
+ bool have_one = false;
for (int i = 0; i < resources->noutput; ++i) {
RROutput output_id = resources->outputs[i];
XRROutputInfo* output_info =
@@ -307,13 +297,13 @@ std::vector<gfx::Display> DesktopScreenX11::BuildDisplaysFromXRandRInfo() {
gfx::Display display(display_id, crtc_bounds);
if (!gfx::Display::HasForceDeviceScaleFactor()) {
- if (i == 0 && !ui::IsDisplaySizeBlackListed(
+ if (!have_one && !ui::IsDisplaySizeBlackListed(
gfx::Size(output_info->mm_width, output_info->mm_height))) {
oshima 2014/10/20 21:11:59 Since it's no longer using the xrandr data, you ca
scottmg 2014/10/22 18:54:14 Done.
// As per display scale factor is not supported right now,
// the primary display's scale factor is always used.
- device_scale_factor = GetDeviceScaleFactor(crtc->width,
- output_info->mm_width);
+ device_scale_factor = gfx::GetDeviceScaleFactor();
DCHECK_LE(1.0f, device_scale_factor);
+ have_one = true;
}
display.SetScaleAndBounds(device_scale_factor, crtc_bounds);
}

Powered by Google App Engine
This is Rietveld 408576698