graphics() improved detection screen resolution (macOS)
This commit is contained in:
+14
-4
@@ -172,10 +172,20 @@ function graphics(callback) {
|
||||
if (4 === level) { // display controller details level
|
||||
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('resolution') !== -1) {
|
||||
let resolution = parts[1].split('x');
|
||||
currentDisplay.resolutionX = (resolution.length > 1 ? parseInt(resolution[0]) : 0);
|
||||
currentDisplay.resolutionY = (resolution.length > 1 ? parseInt(resolution[1]) : 0);
|
||||
currentDisplay.currentResX = currentDisplay.resolutionX;
|
||||
currentDisplay.currentResY = currentDisplay.resolutionY;
|
||||
if (resolution.length > 1) {
|
||||
let xpart = resolution[0];
|
||||
if (xpart.indexOf('(') !== -1) {
|
||||
xpart = xpart.split('(').slice(-1)[0];
|
||||
}
|
||||
let ypart = resolution[1];
|
||||
if (ypart.indexOf(')') !== -1) {
|
||||
ypart = ypart.split(')')[0];
|
||||
}
|
||||
currentDisplay.resolutionX = parseInt(xpart) || 0;
|
||||
currentDisplay.resolutionY = parseInt(ypart) || 0;
|
||||
currentDisplay.currentResX = currentDisplay.resolutionX;
|
||||
currentDisplay.currentResY = currentDisplay.resolutionY;
|
||||
}
|
||||
}
|
||||
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('pixeldepth') !== -1) { currentDisplay.pixelDepth = parseInt(parts[1]); } // in BIT
|
||||
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('framebufferdepth') !== -1) { currentDisplay.pixelDepth = parseInt(parts[1]); } // in BIT
|
||||
|
||||
Reference in New Issue
Block a user