mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[client] wayland: improve fractional scale handling
Currently, we scale the desktop up to the next largest integer, and rely on the wayland compositor to scale it back down to the correct size. This is obviously undesirable. In this commit, we attempt to detect the actual fractional scaling by finding the current active mode in wl_output, and dividing it by the logical screen size reported by xdg_output, taking into consideration screen rotation. We then use wp_viewporter to set the exact buffer and viewport sizes if fractional scaling is needed.
This commit is contained in:
@@ -33,12 +33,12 @@
|
||||
|
||||
void waylandWindowUpdateScale(void)
|
||||
{
|
||||
int32_t maxScale = 0;
|
||||
wl_fixed_t maxScale = 0;
|
||||
struct SurfaceOutput * node;
|
||||
|
||||
wl_list_for_each(node, &wlWm.surfaceOutputs, link)
|
||||
{
|
||||
int32_t scale = waylandOutputGetScale(node->output);
|
||||
wl_fixed_t scale = waylandOutputGetScale(node->output);
|
||||
if (scale > maxScale)
|
||||
maxScale = scale;
|
||||
}
|
||||
@@ -46,6 +46,7 @@ void waylandWindowUpdateScale(void)
|
||||
if (maxScale)
|
||||
{
|
||||
wlWm.scale = maxScale;
|
||||
wlWm.fractionalScale = wl_fixed_from_int(wl_fixed_to_int(maxScale)) != maxScale;
|
||||
wlWm.needsResize = true;
|
||||
}
|
||||
}
|
||||
@@ -77,7 +78,7 @@ static const struct wl_surface_listener wlSurfaceListener = {
|
||||
|
||||
bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool borderless)
|
||||
{
|
||||
wlWm.scale = 1;
|
||||
wlWm.scale = wl_fixed_from_int(1);
|
||||
|
||||
if (!wlWm.compositor)
|
||||
{
|
||||
|
Reference in New Issue
Block a user