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

Draw/Color/Erase: Mouse button can get stuck held down #17

Open
cmang opened this issue Dec 28, 2023 · 1 comment
Open

Draw/Color/Erase: Mouse button can get stuck held down #17

cmang opened this issue Dec 28, 2023 · 1 comment
Labels

Comments

@cmang
Copy link
Owner

cmang commented Dec 28, 2023

There is an annoying bug with the mouse button getting stuck.

To reproduce:
1: Go into a mode where you can click and hold down to do something, like Draw, Erase or Color.
2: Click down on the mouse somewhere in the canvas, and drag the mouse cursor outside of your terminal window.
3: Let go of the mouse button while the cursor is outside of the terminal.
4: Move the mouse cursor back into the terminal window.

Durdraw will still think the mouse button is held down. You can reset this with a single click or double click, usually, and avoid the issue completely by avoiding dragging the cursor outside of the window with the mouse button held down.

This has to do with the (probably dumb) way that Durdraw interacts with Ncurses' mouse functions in /durdraw/durdraw_ui_curses.py, and stores the mouse state.

Here is a link to the appropriate section in a commit, in the monster mainLoop() method:
https://github.com/cmang/durdraw/blob/32e601901477cf6ba25accb7cb09b3dffa5348ba/durdraw/durdraw_ui_curses.py#L1917C37-L1917C37

Any help would be appreciated!

@cmang cmang added the bug label Dec 28, 2023
@cmang cmang changed the title Bug: Mouse button can get stuck Draw/Color/Erase: Mouse button can get stuck held down Dec 28, 2023
@cmang
Copy link
Owner Author

cmang commented Mar 1, 2024

If you find this bug annoying, 625c8c8 makes it so that pressing Esc (command-mode) or any esc-command un-sticks the mouse, to try to help with this issue.

Just a bit more detail... ncurses receives a mouse event when you press down the button, and when you release the button. Durdraw stores this state as a bool member variable called pressingButton (see durdraw_ui_curses.py if you dare).

If you release the button outside of the Xterm window, Durdraw never gets the mouse released event. Annoying. The ncurses mouse state does not seem to distinguish between dragging with the mouse button down, and dragging with it released.

Have any ncurses gurus found a workaround for this problem in implementing mouse click-dragging?

cmang added a commit that referenced this issue Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant