yakui icon indicating copy to clipboard operation
yakui copied to clipboard

Allow changing cursor

Open Uriopass opened this issue 6 months ago • 2 comments

There are lots of useful cases where changing the cursor is important to indicate what action is about to be done. For example links, resizing, dragging, text-editable... See cursor-icon

Since the cursor-icon crate is independent of winit and only exposes that type, I think yakui can expose it directly.

I don't know yakui that well yet but I'm guessing this new API would be added:

impl InputState {
    pub fn set_cursor_icon(&self, icon: cursor_icon::CursorIcon);
    pub fn get_cursor_icon(&self) -> cursor_icon::CursorIcon;
}

Note that it can be easy to lead to a "permanent inappropriate cursor" if a widget forgets to reset the state to cursor_icon::Default. It could be better to always reset the cursor to Default every frame and force required widgets (like links/resize bars) to set the cursor every frame.

EDIT: Forgot to do a search :facepalm:, duplicate of #20 But if @LPGhatguy agrees to the proposal I could go and implement it.

Uriopass avatar Dec 20 '23 10:12 Uriopass