xwayland: Add helper function for fractional scaling
Fractional scaling may not be available, or not suitable for the current configuration (e.g. if running rootless). Add a helper function to tell whether fractional scaling should be used. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-By: Kenny Levinsen <kl@kl.wtf> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1197>
This commit is contained in:
parent
7a78756d0a
commit
3e77c1699a
|
@ -773,6 +773,26 @@ xwl_screen_lost_focus(struct xwl_screen *xwl_screen)
|
|||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
xwl_screen_should_use_fractional_scale(struct xwl_screen *xwl_screen)
|
||||
{
|
||||
/* Fullscreen uses a viewport already */
|
||||
if (xwl_screen->fullscreen)
|
||||
return FALSE;
|
||||
|
||||
if (xwl_screen->rootless)
|
||||
return FALSE;
|
||||
|
||||
/* We need both fractional scale and viewporter protocols */
|
||||
if (!xwl_screen->fractional_scale_manager)
|
||||
return FALSE;
|
||||
|
||||
if (!xwl_screen->viewporter)
|
||||
return FALSE;
|
||||
|
||||
return xwl_screen->hidpi;
|
||||
}
|
||||
|
||||
Bool
|
||||
xwl_screen_update_global_surface_scale(struct xwl_screen *xwl_screen)
|
||||
{
|
||||
|
@ -780,6 +800,9 @@ xwl_screen_update_global_surface_scale(struct xwl_screen *xwl_screen)
|
|||
struct xwl_window *xwl_window;
|
||||
int32_t old_scale;
|
||||
|
||||
if (xwl_screen_should_use_fractional_scale(xwl_screen))
|
||||
return FALSE;
|
||||
|
||||
if (xwl_screen->rootless)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -173,5 +173,6 @@ void xwl_surface_damage(struct xwl_screen *xwl_screen,
|
|||
int xwl_screen_get_next_output_serial(struct xwl_screen * xwl_screen);
|
||||
void xwl_screen_lost_focus(struct xwl_screen *xwl_screen);
|
||||
Bool xwl_screen_update_global_surface_scale(struct xwl_screen *xwl_screen);
|
||||
Bool xwl_screen_should_use_fractional_scale(struct xwl_screen *xwl_screen);
|
||||
|
||||
#endif /* XWAYLAND_SCREEN_H */
|
||||
|
|
Loading…
Reference in New Issue