[Spice-devel] [PATCH] randr: set physical screen size to keep a constant 96 dpi
Christophe Fergeau
cfergeau at redhat.com
Mon Feb 24 03:06:35 PST 2014
["git config format.subjectprefix vdagent-linux" in your vdagent
local clone would be nice]
On Fri, Feb 21, 2014 at 04:17:06PM +0100, Marc-André Lureau wrote:
> Some applications compute DPI based on physcial screen size. Currently,
> the width is reported to be 270mm, regardless of the resolution. This
> patch instead compute a physical screen size to have a constant DPI of
> 96. Of course, there are possible improvements to this approach (see
> fixme), however, since that code is no longer executed with DRM driver,
This depends on having DRM driver running on the guest and a QEMU which
knows about client_monitors_config.
> I don't think we should invest more effort here (I guess DRM driver
> relied on xrandr / gnome-settings-daemon to do the right thing, so
"relied" or "relies" ? The latter I assume?
> physical screen is updated)
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1066094
> ---
> src/vdagent-x11-randr.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
> index 5223f88..9bde7b9 100644
> --- a/src/vdagent-x11-randr.c
> +++ b/src/vdagent-x11-randr.c
> @@ -767,13 +767,16 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11,
> }
>
> if (primary_w != x11->width[0] || primary_h != x11->height[0]) {
> + const int dpi = 96; /* FIXME: read settings from desktop or get from client dpi? */
Iirc xorg hardcodes this to 96 as this is hard to get an accurate/correct
value for this.
> + int fb_width_mm = (25.4 * primary_w) / dpi;
> + int fb_height_mm = (25.4 * primary_h) / dpi;
Maybe add a "1 inch = 25.4mm" comment/a MM_PER_INCHES constant to make this
look less magical?
Looks good, ACK.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140224/576ef3f5/attachment.pgp>
More information about the Spice-devel
mailing list