Skip to content

Conversation

@EvilLary
Copy link
Contributor

@EvilLary EvilLary commented Dec 28, 2025

Currently cursor shape is updated on every pointer event. While I've not found any issues, it just seemed wasteful.

This updates cursor shape only if it doesn't match the previous one

@EvilLary
Copy link
Contributor Author

EvilLary commented Dec 28, 2025

I've also removed the call to update_cursor in Leave event, afaik set_shape request from cursor-shape proto only takes last enter serial, and ignores others.

pls correct me if I'm misunderstanding this

if let Err(err) = pointer.set_cursor(conn, icon) {
warn!("Failed to set cursor icon: {}", err);
}
this.current_pointer_shape = Some(icon);
Copy link
Owner

Choose a reason for hiding this comment

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

I think this can be improved? Should be part of the else block? Cache is updated even when set_cursor fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea I see your point

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Owner

Choose a reason for hiding this comment

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

Some not so important, but still related things to consider.

https://github.com/EvilLary/wayscriber/blob/774e938c9dfc0512c70d69caddcbf78290eec4b1/src/backend/wayland/handlers/seat.rs#L32 - pointer is created, but current_pointer_shape isn't cleared?

Ok(pointer) => {
      debug!("Pointer initialized with theme");
      self.themed_pointer = Some(pointer);
      self.current_pointer_shape = None;
  }

Also, similar, line 74:

if capability == Capability::Pointer {
        info!("Pointer capability removed");
        self.themed_pointer = None;  
        self.current_pointer_shape = None;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added those

@devmobasa
Copy link
Owner

Currently cursor shape is updated on every pointer event. While I've not found any issues, it just seemed wasteful.

This updates cursor shape only if it doesn't match the previous one

Thanks for the PR!

@devmobasa
Copy link
Owner

I've also removed the call to update_cursor in Leave event, afaik set_shape request from cursor-shape proto only takes last enter serial, and ignores others.

pls correct me if I'm misunderstanding this

That seems good to me, unless I am missing something.

@devmobasa
Copy link
Owner

Sorry about clippy and the formatter, not too friendly for first PR.
I updated readme, and added tools/lint-and-test.sh for convenience.

But regardless of that, it looks good to me.

@EvilLary
Copy link
Contributor Author

EvilLary commented Dec 28, 2025

oh mb, updated

@devmobasa devmobasa merged commit 48ddd1e into devmobasa:main Dec 28, 2025
1 check passed
@devmobasa
Copy link
Owner

Thanks!

@EvilLary
Copy link
Contributor Author

oh maybe I should've squashed these commits :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants