Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Diagonal resize cursors on Linux  (Read 12108 times)

0 Members and 1 Guest are viewing this topic.

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Diagonal resize cursors on Linux
« 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).

I know that this is because X11 doesn't support those double arrows, but could directional arrows (e.g. XC_bottom_left_corner) 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).
TGUI: C++ SFML GUI

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Diagonal resize cursors on Linux
« Reply #1 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: Diagonal resize cursors on Linux
« Reply #2 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
« Last Edit: July 25, 2020, 07:25:42 pm by texus »
TGUI: C++ SFML GUI