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

Unified Diff: ui/base/x/x11_util.cc

Issue 27156003: linux_aura: Enable HIDPI support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made GetDeviceScaleFactor clearer. Put unittest to 'all_sources' in .gyp Created 7 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/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 348a9c1489854af6c549ff47b9599dab386fe943..0e256af55c3e3d5e29b511bac5943def8f030a50 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -259,6 +259,16 @@ bool IsShapeAvailable() {
}
+// A list of bogus sizes in mm that X detects that should be ignored.
+// See crbug.com/136533. The first element maintains the minimum
+// size required to be valid size.
+const unsigned long kInvalidDisplaySizeList[][2] = {
+ {40, 30},
+ {50, 40},
+ {160, 90},
+ {160, 100},
+};
+
} // namespace
bool XDisplayExists() {
@@ -1313,6 +1323,25 @@ bool IsX11WindowFullScreen(XID window) {
#endif
}
+bool IsXDisplaySizeBlackListed(unsigned long mm_width,
+ unsigned long mm_height) {
+ // Ignore if the reported display is smaller than minimum size.
+ if (mm_width <= kInvalidDisplaySizeList[0][0] ||
+ mm_height <= kInvalidDisplaySizeList[0][1]) {
+ LOG(WARNING) << "Smaller than minimum display size";
+ return true;
+ }
+ for (unsigned long i = 1 ; i < arraysize(kInvalidDisplaySizeList); ++i) {
+ const unsigned long* size = kInvalidDisplaySizeList[i];
+ if (mm_width == size[0] && mm_height == size[1]) {
+ LOG(WARNING) << "Black listed display size detected:"
+ << size[0] << "x" << size[1];
+ return true;
+ }
+ }
+ return false;
+}
+
const unsigned char* XRefcountedMemory::front() const {
return x11_data_;
}

Powered by Google App Engine
This is Rietveld 408576698