Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] DPI/Scale/Zoom introduce issues #346

Open
emmkimme opened this issue Mar 2, 2020 · 12 comments
Open

[Windows] DPI/Scale/Zoom introduce issues #346

emmkimme opened this issue Mar 2, 2020 · 12 comments

Comments

@emmkimme
Copy link

emmkimme commented Mar 2, 2020

I have 3 monitors 1920x1080.
Calling si.displays I get :

{
    "displays": [
        {
            "vendor": "",
            "model": "Default Monitor",
            "main": true,
            "builtin": true,
            "connection": "INTERNAL",
            "resolutionx": 1920,
            "resolutiony": 1200,
            "sizex": 52,
            "sizey": 32,
            "pixeldepth": "32",
            "currentResX": 1920,
            "currentResY": 1200,
            "positionX": 0,
            "positionY": 0
        },
        {
            "vendor": "",
            "model": "Default Monitor",
            "main": false,
            "builtin": false,
            "connection": "DP",
            "resolutionx": 1920,
            "resolutiony": 1200,
            "sizex": 52,
            "sizey": 32,
            "pixeldepth": "32",
            "currentResX": 1920,
            "currentResY": 1200,
            "positionX": 1920,
            "positionY": 0
        },
        {
            "vendor": "",
            "model": "Default Monitor",
            "main": false,
            "builtin": false,
            "connection": "DP",
            "resolutionx": 1920,
            "resolutiony": 1200,
            "sizex": 52,
            "sizey": 32,
            "pixeldepth": "32",
            "currentResX": 1920,
            "currentResY": 1200,
            "positionX": 3840,
            "positionY": 0
        }
    ]
}

which is expected.

But when I change the scale of the 1st monitor to 150% for instance, I get

{
    "displays": [
        {
            "vendor": "",
            "model": "Default Monitor",
            "main": true,
            "builtin": true,
            "connection": "INTERNAL",
            "resolutionx": 1280,
            "resolutiony": 800,
            "sizex": 52,
            "sizey": 32,
            "pixeldepth": "32",
            "currentResX": 1280,
            "currentResY": 800,
            "positionX": 0,
            "positionY": 0
        },
        {
            "vendor": "",
            "model": "Default Monitor",
            "main": false,
            "builtin": false,
            "connection": "DP",
            "resolutionx": 1920,
            "resolutiony": 1200,
            "sizex": 52,
            "sizey": 32,
            "pixeldepth": "32",
            "currentResX": 1920,
            "currentResY": 1200,
            "positionX": 1920,
            "positionY": 0
        },
        {
            "vendor": "",
            "model": "Default Monitor",
            "main": false,
            "builtin": false,
            "connection": "DP",
            "resolutionx": 1920,
            "resolutiony": 1200,
            "sizex": 52,
            "sizey": 32,
            "pixeldepth": "32",
            "currentResX": 1920,
            "currentResY": 1200,
            "positionX": 3840,
            "positionY": 0
        }
    ]
}

The scaling is correct 1920/1280 = 150%.
But the current X position of the 2nd monitor is still 1920 not 1280.
There is no way to know the 1st monitor has been scaled (original resolution is lost).

Expected behavior
The X position of the 2nd monitor must be 1280.
Have information which help to detect a monitor is 'scaled' and how much.

Environment:

  • systeminformation package version: 4.22.3
  • OS: Windows 10.0.17134 Build 17134
  • Hardware : Dell Latitude 5591/Intel(R) UHD Graphics 630/Monitor DELL U2410
@sebhildebrandt
Copy link
Owner

@emmkimme can you run the following commands in both resolutions and post the output here (as text)?

wmic path win32_VideoController get /value
wmic path win32_desktopmonitor get /value
powershell Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams | fl
powershell Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens
powershell Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorConnectionParams | fl

Thank you in advance.

@emmkimme
Copy link
Author

emmkimme commented Mar 2, 2020

Output with 100%
wmic100.txt
Output with 150%
wmic150.txt

@OmgImAlexis
Copy link
Contributor

Currently on Windows 10 and I have my main monitor set to 4k with a scale of 200%, my second is set to 1440x900 with 0 scaling.

wmic path win32_VideoController get /value
AcceleratorCapabilities=
AdapterCompatibility=NVIDIA
AdapterDACType=Integrated RAMDAC
AdapterRAM=2147483648
Availability=3
CapabilityDescriptions=
Caption=NVIDIA GeForce GTX 1050
ColorTableEntries=
ConfigManagerErrorCode=0
ConfigManagerUserConfig=FALSE
CreationClassName=Win32_VideoController
CurrentBitsPerPixel=32
CurrentHorizontalResolution=1440
CurrentNumberOfColors=4294967296
CurrentNumberOfColumns=0
CurrentNumberOfRows=0
CurrentRefreshRate=59
CurrentScanMode=4
CurrentVerticalResolution=900
Description=NVIDIA GeForce GTX 1050
DeviceID=VideoController1
DeviceSpecificPens=
DitherType=0
DriverDate=20210913000000.000000-000
DriverVersion=30.0.14.7212
ErrorCleared=
ErrorDescription=
ICMIntent=
ICMMethod=
InfFilename=oem42.inf
InfSection=Section044
InstallDate=
InstalledDisplayDrivers=C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_19c79fb6254e3b11\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_19c79fb6254e3b11\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_19c79fb6254e3b11\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_19c79fb6254e3b11\nvldumdx.dll
LastErrorCode=
MaxMemorySupported=
MaxNumberControlled=
MaxRefreshRate=75
MinRefreshRate=56
Monochrome=FALSE
Name=NVIDIA GeForce GTX 1050
NumberOfColorPlanes=
NumberOfVideoPages=
PNPDeviceID=PCI\VEN_10DE&DEV_1C81&SUBSYS_85C71043&REV_A1\4&25438C51&0&0008
PowerManagementCapabilities=
PowerManagementSupported=
ProtocolSupported=
ReservedSystemPaletteEntries=
SpecificationVersion=
Status=OK
StatusInfo=
SystemCreationClassName=Win32_ComputerSystem
SystemName=ALEXIS-TOWER
SystemPaletteEntries=
TimeOfLastReset=
VideoArchitecture=5
VideoMemoryType=2
VideoMode=
VideoModeDescription=1440 x 900 x 4294967296 colors
VideoProcessor=NVIDIA GeForce GTX 1050
wmic path win32_desktopmonitor get /value
Availability=8
Bandwidth=
Caption=Generic PnP Monitor
ConfigManagerErrorCode=0
ConfigManagerUserConfig=FALSE
CreationClassName=Win32_DesktopMonitor
Description=Generic PnP Monitor
DeviceID=DesktopMonitor1
DisplayType=
ErrorCleared=
ErrorDescription=
InstallDate=
IsLocked=
LastErrorCode=
MonitorManufacturer=(Standard monitor types)
MonitorType=Generic PnP Monitor
Name=Generic PnP Monitor
PixelsPerXLogicalInch=96
PixelsPerYLogicalInch=96
PNPDeviceID=DISPLAY\ACI19A9\5&2707C34E&0&UID4352
PowerManagementCapabilities=
PowerManagementSupported=
ScreenHeight=
ScreenWidth=
Status=OK
StatusInfo=
SystemCreationClassName=Win32_ComputerSystem
SystemName=ALEXIS-TOWER
powershell Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams | fl
Active                        : True
DisplayTransferCharacteristic : 120
InstanceName                  : DISPLAY\ACI19A9\5&2707c34e&0&UID4352_0
MaxHorizontalImageSize        : 41
MaxVerticalImageSize          : 26
SupportedDisplayFeatures      : WmiMonitorSupportedDisplayFeatures
VideoInputType                : 1
PSComputerName                :

Active                        : True
DisplayTransferCharacteristic : 120
InstanceName                  : DISPLAY\ACI24AD\5&2707c34e&0&UID4354_0
MaxHorizontalImageSize        : 52
MaxVerticalImageSize          : 29
SupportedDisplayFeatures      : WmiMonitorSupportedDisplayFeatures
VideoInputType                : 1
PSComputerName                :
powershell Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens
Unable to find type [System.Windows.Forms.Screen].
At line:1 char:57
+ ... emblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScr ...
+                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Windows.Forms.Screen:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound
powershell Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorConnectionParams | fl
Active InstanceName                           VideoOutputTechnology PSComputerName
------ ------------                           --------------------- --------------
  True DISPLAY\ACI19A9\5&2707c34e&0&UID4352_0                     4
  True DISPLAY\ACI24AD\5&2707c34e&0&UID4354_0                    10

@sebhildebrandt
Copy link
Owner

sebhildebrandt commented Oct 9, 2021

@OmgImAlexis interesting output ...

  • I wonder why wmic path win32_desktopmonitor get /value just reports ONE monitor
  • also interesting is that powershell Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens returns an error ...

Any ideas? And what is then the output from systeminformation on your machine?

@OmgImAlexis
Copy link
Contributor

  • I wonder why wmic path win32_desktopmonitor get /value just reports ONE monitor

Could this be because I'm using two different output types? I have the 4k one using displayport and the other using DVI. 🤔

  • also interesting is that powershell Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens returns an error ...

Found the issue. Needed to have the assemblies loaded.

PS C:\Users\xo> [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
PS C:\Users\xo> powershell Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens


BitsPerPixel : 32
Bounds       : {X=3840,Y=1080,Width=1440,Height=900}
DeviceName   : \\.\DISPLAY1
Primary      : False
WorkingArea  : {X=3840,Y=1080,Width=1440,Height=900}

BitsPerPixel : 32
Bounds       : {X=0,Y=0,Width=1920,Height=1080}
DeviceName   : \\.\DISPLAY2
Primary      : True
WorkingArea  : {X=72,Y=0,Width=1848,Height=1080}

@OmgImAlexis
Copy link
Contributor

Also to note I only have a taskbar on the 4k monitor and it's set to be on the left.

@sebhildebrandt
Copy link
Owner

@OmgImAlexis so and what would be the output from systeminformation?

const si = require('systeminformation');
si.graphics().then(data => console.log(data));

Is there also a need on your machine to load assemblies first? Do I need to include this to the script (graphics.js, line 776)?

@sebhildebrandt
Copy link
Owner

@emmkimme ... two things:

  • I guess it is possible to set the positionx for the monitors in scaled environments correctly, will come up with a solution
  • and for the scaling, not sure if I can add this correctly... need to work on it.

@OmgImAlexis
Copy link
Contributor

Here's the output from the js snippet you posted.

{
  controllers: [
    {
      vendor: 'NVIDIA',
      model: 'NVIDIA GeForce GTX 1050',
      bus: 'PCI',
      vram: 2048,
      vramDynamic: false,
      subDeviceId: '0x85C71043',
      driverVersion: '472.12',
      name: 'NVIDIA GeForce GTX 1050',
      pciBus: '00000000:01:00.0',
      memoryTotal: 2048,
      memoryUsed: 1664,
      memoryFree: 384,
      utilizationMemory: 3,
      temperatureGpu: 46,
      powerLimit: 65,
      clockCore: 1385,
      clockMemory: 3504
    }
  ],
  displays: [
    {
      vendor: '(Standard monitor types)',
      model: 'Generic PnP Monitor',
      deviceName: '\\\\.\\DISPLAY1',
      main: false,
      builtin: false,
      connection: 'DVI',
      resolutionX: 1440,
      resolutionY: 900,
      sizeX: 41,
      sizeY: 26,
      pixelDepth: '32',
      currentResX: 1440,
      currentResY: 900,
      positionX: 3840,
      positionY: 1080
    },
    {
      vendor: '',
      model: '',
      deviceName: '\\\\.\\DISPLAY2',
      main: true,
      builtin: false,
      connection: 'DP',
      resolutionX: 1920,
      resolutionY: 1080,
      sizeX: 52,
      sizeY: 29,
      pixelDepth: '32',
      currentResX: 1920,
      currentResY: 1080,
      positionX: 0,
      positionY: 0
    }
  ]
}

@OmgImAlexis
Copy link
Contributor

Interestingly Windows "Display settings" shows my 4k as monitor 1.

image

@OmgImAlexis
Copy link
Contributor

Is there also a need on your machine to load assemblies first? Do I need to include this to the script (graphics.js, line 776)?

Not sure. I did need it when I ran the commands manually in terminal/powershell.

@toowhite
Copy link

toowhite commented Jun 1, 2023

Information in this issue is quite helpful for me to develop my own package. Sorry @sebhildebrandt I gave up using systeminformation as your fix has not been released. However, I can provide some more information for you to develop the solution.

My monitor configuration is like that:

and the output I got from above PS commands is:

BitsPerPixel : 32
Bounds       : {X=2560,Y=516,Width=1280,Height=720}
DeviceName   : \\.\DISPLAY1
Primary      : False
WorkingArea  : {X=2560,Y=516,Width=1280,Height=720}

BitsPerPixel : 32
Bounds       : {X=0,Y=0,Width=1920,Height=1080}
DeviceName   : \\.\DISPLAY2
Primary      : True
WorkingArea  : {X=0,Y=0,Width=1920,Height=1040}

BitsPerPixel : 32
Bounds       : {X=-1440,Y=-764,Width=1080,Height=1920}
DeviceName   : \\.\DISPLAY3
Primary      : False
WorkingArea  : {X=-1440,Y=-764,Width=1080,Height=1920}

Below are the original resolution and scaling for each monitor:

  • 1920*1080, 150%
  • 3840*2160, 200%
  • 2160*3840, 200% (the same model as Display 2, but in portrait orientation)

Comparing the information, it seems that the positions of all monitors (X and Y in Bounds) are in terms of the scaling of Display 1. For example, here 2160*1.5=3840; and if I change scaling of Display 1 to 1.75, the output changes to

BitsPerPixel : 32
Bounds       : {X=2194,Y=442,Width=1097,Height=617}
DeviceName   : \\.\DISPLAY1
Primary      : False
WorkingArea  : {X=2194,Y=442,Width=1097,Height=617}

BitsPerPixel : 32
Bounds       : {X=0,Y=0,Width=1920,Height=1080}
DeviceName   : \\.\DISPLAY2
Primary      : True
WorkingArea  : {X=0,Y=0,Width=1920,Height=1040}

BitsPerPixel : 32
Bounds       : {X=-1234,Y=-655,Width=1080,Height=1920}
DeviceName   : \\.\DISPLAY3
Primary      : False
WorkingArea  : {X=-1234,Y=-655,Width=1080,Height=1920}

And we see 2194*1.75=3839.5.

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants