Chromium Code Reviews| 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..48c9e6106aed6995a56654f3af580db216697582 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]) { |
|
Daniel Erat
2013/10/29 14:28:25
nit: indent this two more spaces to line up with t
|
| + 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_; |
| } |