Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol: add cursor_shape #32

Merged
merged 1 commit into from
Oct 30, 2023
Merged

protocol: add cursor_shape #32

merged 1 commit into from
Oct 30, 2023

Conversation

kchibisov
Copy link
Contributor

@kchibisov kchibisov commented Oct 2, 2023

No description provided.

@kchibisov
Copy link
Contributor Author

@YaLTeR should probably work now.

@kchibisov kchibisov force-pushed the cursor-shape branch 2 times, most recently from 80318ee to db00be8 Compare October 28, 2023 17:43
@YaLTeR
Copy link
Owner

YaLTeR commented Oct 30, 2023

Okay, I believe I got everything working now.

@YaLTeR
Copy link
Owner

YaLTeR commented Oct 30, 2023

Oh, looks like I accidentally erased the commit author. How do I get it back easily?

src/niri.rs Show resolved Hide resolved
static FALLBACK_CURSOR_DATA: &[u8] = include_bytes!("../resources/cursor.rgba");

type CursorCache = HashMap<i32, (TextureBuffer<GlesTexture>, Point<i32, Physical>)>;
type XCursorCache = HashMap<(CursorIcon, i32), Option<Rc<XCursor>>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the reason it's being stored in Rc? It's not like using references won't really work when providing the cached item, given that it worked just fine before.

The only benefit of Rc which you're not using is to spread the default cursor into other variants.

Copy link
Owner

Choose a reason for hiding this comment

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

I needed &self in get() signature, so I need this inside a RefCell. So the get() would need to return a Ref or RefMut. But I couldn't map RefMut<HashMap> into a RefMut<Option<&XCursor>>, only a RefMut<Option<XCursor>>, which is not what I wanted. So I changed it to an Rc. Basically, battle lost with the borrow checker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you see, RefCell is evil, could just have &mut and it'll be more or less fine...

Copy link
Contributor Author

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

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

I guess it's fine then.

@YaLTeR YaLTeR merged commit 0888778 into YaLTeR:main Oct 30, 2023
4 checks passed
@YaLTeR
Copy link
Owner

YaLTeR commented Oct 30, 2023

Thanks

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