display-info icon indicating copy to clipboard operation
display-info copied to clipboard

Getting wrong scale_factor

Open sandyfigueroa opened this issue 6 months ago • 5 comments

SO: Windows 11 display-info version: "0.4.3"

I am using this library to get information about my monitors.

Right now I have two screens, one is the one integrated in my laptop (1920x1080, scale factor 1.25) and an external one (2560x1080, scale factor 1)

Using DisplayInfo::all() to get the information and printing the scale_factor for all the monitors gives me a scale factor of 1 for all of them.

The other information seems to be ok, for example, the resolution (same ones I mentioned before) but the scale factor is wrong.

No matter if I have the external monitor connected or disconnected, I always get a scale factor of 1 for my integrated screen, which it is actually 1.25 (125%).

I need to do some calculations with this number, but they are wrong, since I cannot get the correct value for it using this library.

Tried using this library on Electronjs using Node-API, and also on Tauri, but the same issue on both.

I am just printing it like this:

                println!("Scale factor: {}", display_info.scale_factor);
                println!("x: {}, y: {}", display_info.x, display_info.y);
                println!(
                    "Width: {}, Height: {} \n",
                    display_info.width, display_info.height
                );

This is what I get:

Scale factor: 1
x: 0, y: 0
Width: 1920, Height: 1080

Scale factor: 1
x: 1920, y: 0
Width: 2560, Height: 1080

image

But my monitor: image

sandyfigueroa avatar Dec 08 '23 23:12 sandyfigueroa