Skip to content

Replace libxcursor with custom cursor code#3749

Merged
notgull merged 1 commit intomasterfrom
notgull/no-xcursor
Aug 23, 2024
Merged

Replace libxcursor with custom cursor code#3749
notgull merged 1 commit intomasterfrom
notgull/no-xcursor

Conversation

@notgull
Copy link
Copy Markdown
Member

@notgull notgull commented Jun 22, 2024

Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@notgull notgull requested a review from kchibisov as a code owner June 22, 2024 19:30
@notgull notgull force-pushed the notgull/no-xcursor branch 3 times, most recently from b591543 to f19993a Compare June 22, 2024 19:32
@notgull notgull added DS - x11 Affects the X11 backend, or generally free Unix platforms S - maintenance Repaying technical debt labels Jun 22, 2024
@notgull notgull force-pushed the notgull/no-xcursor branch 2 times, most recently from 92b431b to 17c60e7 Compare June 24, 2024 00:45
@notgull notgull added the C - nominated Nominated for discussion in the next meeting label Jun 27, 2024
@madsmtm madsmtm removed the C - nominated Nominated for discussion in the next meeting label Jun 28, 2024
@madsmtm
Copy link
Copy Markdown
Member

madsmtm commented Jun 28, 2024

Meeting resolution: @kchibisov will take a look once he has time

@notgull
Copy link
Copy Markdown
Member Author

notgull commented Jul 28, 2024

@kchibisov Have you had a chance to look over this one yet?

@notgull notgull requested review from daxpedda and madsmtm August 1, 2024 02:14
Copy link
Copy Markdown
Member

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Works flawlessly.

I'm fine with panicking if we can reasonably assume that this shouldn't happen.
But if it can happen, I believe we have two choices: print the error with tracing and move on (which other backends do as well right now), or return the error to the user, which would necessitate an API change.

I would be in favor of an API change in a follow-up, other backends could make use of that as well. So my suggestion would be to not panic and print the error in tracing in this PR, unless of course in your opinion this should never happen.

@notgull
Copy link
Copy Markdown
Member Author

notgull commented Aug 2, 2024

X11 sits on top of the I/O stack and every I/O function is fallible. So every winit function would also need to return a Result. Not that I oppose this; I think this is the ideal way to go.

@daxpedda
Copy link
Copy Markdown
Member

daxpedda commented Aug 2, 2024

X11 sits on top of the I/O stack and every I/O function is fallible. So every winit function would also need to return a Result. Not that I oppose this; I think this is the ideal way to go.

I made #3844 to address at least this PR.
So for this PR I propose:

  • Return an error in create_custom_cursor().
  • If an error happens in set_cursor(), use tracing to deliver the error and do nothing instead of panicking. Lets address this in the future more globally.

WDYT?

@kchibisov
Copy link
Copy Markdown
Member

Yeah, in general, if you can not set something you just do nothing. There's no guarantee that all the functions will work, because window manager can just ignore the request and you generally don't know that until you try to query it.

So just ignore the errors for setting cursor(that's how it's done on Wayland as well here).

@notgull
Copy link
Copy Markdown
Member Author

notgull commented Aug 10, 2024

  • Return an error in create_custom_cursor().

  • If an error happens in set_cursor(), use tracing to deliver the error and do nothing instead of panicking. Lets address this in the future more globally.

I've set this up now.

@notgull notgull force-pushed the notgull/no-xcursor branch from 2e31070 to 07a8d38 Compare August 10, 2024 02:32
@daxpedda daxpedda added the C - nominated Nominated for discussion in the next meeting label Aug 15, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
@notgull notgull force-pushed the notgull/no-xcursor branch from 07a8d38 to 876cd0a Compare August 23, 2024 02:25
@notgull notgull merged commit aee9511 into master Aug 23, 2024
@notgull notgull deleted the notgull/no-xcursor branch August 23, 2024 02:30
@daxpedda daxpedda removed the C - nominated Nominated for discussion in the next meeting label Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - x11 Affects the X11 backend, or generally free Unix platforms S - maintenance Repaying technical debt

Development

Successfully merging this pull request may close these issues.

5 participants