SFML community forums

General => Feature requests => Topic started by: texus on July 12, 2020, 05:51:22 pm

Title: Diagonal resize cursors on Linux
Post by: texus on July 12, 2020, 05:51:22 pm
I would like to change the mouse cursor when the mouse is at the corner of a child window in my gui, but SFML doesn't support diagonal arrows on Linux (Cursor.hpp#L65-L66 (https://github.com/SFML/SFML/blob/3557c46ae65a32ac6fc49d81ec026d6a0787564d/include/SFML/Window/Cursor.hpp#L65-L66)).

I know that this is because X11 doesn't support those double arrows, but could directional arrows (e.g. XC_bottom_left_corner (https://tronche.com/gui/x/xlib/appendix/b/)) perhaps be added?
The following would be useful, but only the last 4 are required to add support for diagonal resizing on linux.
- SizeLeft
- SizeRight
- SizeTop
- SizeBottom
- SizeTopLeft
- SizeTopRight
- SizeBottomLeft
- SizeBottomRight

On linux, all of those exist.

On windows, none of those exist. It should be easy to just display the double arrow if one of those directional sizes are requested though.

On macOS, all of those should also exist, but are undocumented just like the diagonal double arrows. I'm not sure if they are ever used on mac though, maybe it would be better to fall back to double arrows here as well (for my gui I would only try to set those directional cursors in Linux anyway and use double arrows on Windows and macOS).

Is there any chance that those cursors could be added to SFML, even though they are specific for Linux?
I've already changed my code to just load those cursors directly and only use SFML when loading other cursors, but it would be nice if I could set those cursors via SFML as well in future SFML versions (as I now have to link with Xlib myself).
Title: Re: Diagonal resize cursors on Linux
Post by: eXpl0it3r on July 25, 2020, 03:28:33 pm
I think that would make sense. The cursor support is already set up to vary on different platforms, so not being able to 100% support it, would be fine for me. :)

Are you willing to provide an implementation?
Title: Re: Diagonal resize cursors on Linux
Post by: texus on July 25, 2020, 05:35:05 pm
Yes, I can send a PR for this.
I guess I'll just implement the fall back to the double arrows on macOS for now, if anyone wants it differently then it could still be changed later.

Edit: see PR #1688 (https://github.com/SFML/SFML/pull/1688)