How could an application know the desktop scale factor? ????
Ilya Anfimov
ilan at astelecom.ru
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
> (https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output)
> and Mir has (https://unity.ubuntu.com/mir/struct_mir_display_output.html),
> 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
events.
If RANDR is not supported or reports 0 screen size -- than fall-
back to using XDisplayHeightMM/XDisplayHeight and XDisplayWidth-
MM/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 (https://developer.blender.org/T48292).
>
> Thanks in advance.
>
>
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: https://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s
More information about the xorg
mailing list