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

Sometimes xcolor does not respond to mouse clicks #32

Open
infmagic2047 opened this issue Jan 31, 2022 · 1 comment
Open

Sometimes xcolor does not respond to mouse clicks #32

infmagic2047 opened this issue Jan 31, 2022 · 1 comment

Comments

@infmagic2047
Copy link

If I left-click while moving the mouse (especially when moving fast), sometimes xcolor does not catch the left-click, and instead keep running as if there were no clicks.

My preliminary debugging shows that, in wait_for_location function, there are indeed no left-click event received when this happens. Maybe the event is somehow lost when there are too many events (the mouse moving) to handle.

@brainwo
Copy link

brainwo commented Mar 5, 2025

I did some digging into this. It seems like the root cause is that it took too long to redraw the new cursor when cursor is moved, so the click event is skipped.

let event: &xproto::MotionNotifyEvent = unsafe { xbase::cast_event(&event) };
let new_cursor = create_new_cursor(
    conn,
    screen,
    preview_width,
    scale,
    Some((event.root_x(), event.root_y())),
)?;
update_cursor(conn, new_cursor)?;

xproto::free_cursor(conn, cursor);
cursor = new_cursor;

https://github.com/Soft/xcolor/blob/969d6525c4568a2fafd321fcd72a95481c5f3c7b/src/location.rs#L201C1-L212C41

When you commented this line, it works just fine. Tested for scenario in #42.

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

No branches or pull requests

2 participants