How could an application know the desktop scale factor? ????

Ilya Anfimov ilan at
Fri May 6 17:10:59 UTC 2016

On Fri, May 06, 2016 at 04:54:10PM +0200, Alberto Salvia Novella wrote:
> Is there any way an application could tell the current desktop scaling
> factor independently of the desktop environment in use?
> For example Wayland has
> (
> and Mir has (,
> which both could be used for telling the physical size of the output device.

 Obtaining  physical  size is relatively easy: if RANDR extension
is supported, than try to get information  with  XRRGetScreenInfo
on  your  window, and get per-axis dpi by dividing current screen
size in mm by current screen size in pixels, multiplied  by  25.4
(with respect to current rotation, as sizes reported for original
x/y axes, and their meaning could be changed by rotation).

With RANDR you can also subscribe  to  screen  resolution  change

 If RANDR is not supported or reports 0 screen size -- than fall-
back to using XDisplayHeightMM/XDisplayHeight and  XDisplayWidth-

 It looks like there is no practice of regular scaling windows by
a compositing WM, so you can assume that scaling factor is 1.

> So you can tell how to scale your application interface to have a good size.
> This is for solving bug (
> Thanks in advance.

> _______________________________________________
> xorg at X.Org support
> Archives:
> Info:
> Your subscription address: %(user_address)s

More information about the xorg mailing list