Sfml: When manually setting the cursor to sf::Cursor::Arrow in Linux the cursor gets mirrored

Created on 30 Jul 2019  路  4Comments  路  Source: SFML/SFML

Subject of the issue

When manually setting the cursor to sf::Cursor::Arrow, the cursor shows a mirrored arrow cursor. The arrowed mirror cursor is not like my default cursor either, and actually looks like the default X11-cursor, but a mirrored version (the arrow points towards the right instead of left). I would take a screenshot if I could, but none of the programs I used are able to take a screenshot showing this cursor.

Your environment

  • Your OS / distro / window manager used
    Manjaro Linux with the i3 desktop environment

  • Your version of SFML
    SFML 2.5.1

  • Your compiler and compiler version used
    GCC9

Steps to reproduce

#include <SFML/Graphics.hpp>

// Just a cursor dummy application
int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
    // ... create window as usual ...
    sf::Cursor cursor;
    if (cursor.loadFromSystem(sf::Cursor::Arrow))
        window.setMouseCursor(cursor);

    while(window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window: exit
            if (event.type == sf::Event::Closed)
                window.close();
        }
        // Clear screen
        window.clear();
        // Update the window
        window.display();
    }

    return 0;
}

Expected behavior

I expect to get the default arrow cursor of my system

Actual behavior

I get a mirrored arrow cursor that is not the same arrow as the one used on my system. Looks just like the default cursor of X11, but mirrored.

bug sfml-window linux

All 4 comments

well your Same works fine on my visual studio 17

@pawankholiya01: It's a Linux issue, which means it's probably fine for both Windows and OS X.

Hello. Can you please try out how SDL behaves with similarly-named cursors? See https://wiki.libsdl.org/SDL_CreateSystemCursor

I won't be surprised if it's some X11/DE issue, as cursor types don't seem to be very stable between DEs.

I got the exact same problem on my Arch install with i3wm, but I think this has nothing to do with the distro or WM/DE.

I installed a cursor theme and it was broken. The "arrow" cursor doesn't exist in my theme, but the system still find it with "left_ptr".

So I checked a non-broken cursor theme, Adwaita, and what I found was various symlinks to provide the cursor names application expect to find.
So there was arrow -> left_ptr and also grab -> hand1

Basically your cursor theme is broken, so either fix it by creating new symlinks (fixed the issue for me) or install a non-broken theme.

The mirrored arrow is just a fallback because the system can't find the cursor you're asking for.

@SSBMTonberry tagging if you're still looking for a solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Flone-dnb picture Flone-dnb  路  3Comments

eliasdaler picture eliasdaler  路  6Comments

shayanaminnjad picture shayanaminnjad  路  8Comments

FQLT picture FQLT  路  9Comments

jecse picture jecse  路  7Comments