mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
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>
(cherry picked from commit 3e77c1699a)
This commit is contained in:
committed by
Alan Coopersmith
parent
a2491a5d08
commit
7e4862c596
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user