Skip to content
  • Roman Gilg's avatar
    xwayland: Multi DPI support via max factor rescaling · b66a1845
    Roman Gilg authored
    
    
    To benefit from Wayland's multi DPI capabilities in XWayland a global scaling
    factor is introduced, which is defined as the maximum scale factor of all
    currently available wl_outputs.
    
    The RandR size of an output is calculated by the (integer-)multiplication of
    this global scaling factor with its logical size received via the xdg-output
    protocol.
    
    In other words the size of any RandR screen corresponds to the mode size of
    its wl_output multiplied with the quotient of maximum scaling factor divided by
    the compositor's internal output-dependent scaling factor.
    
    HiDPI aware X clients can then provide Pixmaps enlarged by the global scaling
    factor and the Wayland compositor is supposed to downscale these buffers on
    outputs scaled by less than the global scaling factor.
    
    A Wayland compositor needs to scale all X communication in its XWM part by the
    global scaling factor, such that X windows have the correct geometry.
    
    In summary:
    * All positions in Wayland internal communication must be carried out by the
    compositor in logical coordinates, i.e. in its compositor space.
    * All positions in X internal communication are based on RandR sizes.
    * All positions in Wayland to X communication must be multiplied by the global
    scaling factor.
    * All positions in X to Wayland communication must be divided by the global
    scaling factor.
    
    In order to not break compositors, that do not support these transformations,
    the global scaling factor must be enabled explicitly by the compositor via the
    -multidpi flag when launching XWayland.
    
    Signed-off-by: default avatarRoman Gilg <subdiff@gmail.com>
    b66a1845