Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wayland with GNOME and 200% scaling sets fractionalScale to true, causing bufferScale to not be updated, resulting in a blurry cursor #2794

@sebale16

Description

@sebale16

OS and version: 6.17.8-arch1-1
Release or commit: GLFW 3.4
Error messages: no error messages

Using Wayland on Arch Linux with GNOME 49.2, 200% system scaling sets window->wl.fractionalScale to true even though it is not a fractional scale:

src/wl_window.c lines 403-404

void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window)
{
...
    if (window->wl.fractionalScale)
        return;
...
}

This causes _glfwUpdateBufferScaleFromOutputsWayland to exit early. As a result, window->wl.bufferScale is never updated to 2 and stays at 1. In the setCursorImage function, this then causes the cursor to not be set to cursorWayland->cursorHiDPI and its scale to not be updated to 2. In the wl_surface_set_buffer_scale call, the compositor is then fed a 24x24px cursor image instead of a 48x48px image, which it then scales by 2, resulting in a blurry cursor when running the examples:

src/wl_window.c lines 1092-1096, 1117

static void setCursorImage(_GLFWwindow* window,
                           _GLFWcursorWayland* cursorWayland)
{
...
        if (window->wl.bufferScale > 1 && cursorWayland->cursorHiDPI)
        {
            wlCursor = cursorWayland->cursorHiDPI;
            scale = 2;
        }
...
    wl_surface_set_buffer_scale(surface, scale);
...
}

Commenting lines 403-404 in src/wl_window.c fixes the blurriness problem but causes the mouse to be half as small. I will open another issue for this, as I have found the cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    WaylandbugBug reports and bugfix pull requests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions