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

Add simulate support for mouse middle btn and "*DOWN" mouse btn events #4797

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

wiktor-obrebski
Copy link
Contributor

@wiktor-obrebski wiktor-obrebski commented Jul 7, 2024

Add support for _MOUSE_L_DOWN, _MOUSE_R_DOWN, _MOUSE_M_DOWN and _MOUSE_M to simulateInput function.

Withot it, it is impossible to test some of gui scripts (e.g. journal) in integration way, as only _MOUSE_L and _MOUSE_R inputs are working with gui.simulateInput right now.

The same table (MOUSE_KEYS) is also used on ZScreen:onInput. I am not sure if this can affect it negatively somehow.

@wiktor-obrebski wiktor-obrebski force-pushed the chore/simulate-mouse-fix branch from 5adfc67 to 6c38eea Compare July 9, 2024 06:14
@myk002
Copy link
Member

myk002 commented Jul 9, 2024

I forgot to mention this before: please feel free to add yourself to https://github.com/DFHack/dfhack/blob/develop/docs/about/Authors.rst

Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

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

I looked through the history to see why I implemented it this way. I found #3841 (comment)

We don't touch mbut in general so that map scrolling continues to work. The _down
fields should not be modified since it can break dragging. Widgets capture the mouse
on button click and then react to _down if they handled the click. if we mess with
_down, then we can break whatever thinks the mouse belongs to them (including our
own window dragging mechanism).

Could you test to see if this breaks middle button map dragging when a ZScreen is visible, as well as general window dragging/resizing?

@wiktor-obrebski
Copy link
Contributor Author

Could you test to see if this breaks middle button map dragging when a ZScreen is visible, as well as general window dragging/resizing?

I tested dragging and resizing, also background map movement (by mouse) for few zscreen tools, including gui/layout, gui/journal, open-legens and gui/quickfort. I did not detect any unexpected behaviour.

@myk002 myk002 merged commit b12e33f into DFHack:develop Jul 10, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants