Skip to content

rdp: fix distorted image when devicePixelRatio != 1 (screen scale factor != 100%)

Fabio Bas requested to merge ctrlaltca/krdc:fix_dpi into master

This can be tested by setting screen scale factor to something different than 100% in system settings, eg. to 125% that is a common value for hidpi screens these days. When screen scale is 125%, even if the screen resolution is eg. 1920x1080, a full screen widget will report a size of 1536x864. This leads to krdc requesting to the remote rdp server a video with a resolution of 1536x864, that when painted to the screen will result to a badly scaled image. In order to get a pixel-perfect image shown on the screen, we need to request to the remote server the "real" resolution of the screen size we are painting on, and paint the resulting images from the video ensuring they have the same devicePixelRatio of our widget.

Another problem. addressed in the second commit, is that krdc used to save the remoteview widget size to the config as the resolution. If i set the resolution to 1920x1080, after the first save it will become 1536x864. After a second save it will be reduced of another 1.25x, and so on. By now the commit removes this "feature". In order to keep this feature, video size and window size should be saved separately; i'm not sure there is any convenience in doing so anyway.

Merge request reports