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

Update IGraphicsMac_view.mm - getMouseLeft #1022

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

janhase88
Copy link

Hi guys,
This PR addresses this issue

Problem

The getMouseLeft function in IGraphicsMac_view.mm incorrectly sets the left mouse button state to always true, regardless of its actual state.

Changes

  • Updated the getMouseLeft method to use NSEvent for determining the actual state of the left mouse button.

Code Update

- (IMouseInfo) getMouseLeft: (NSEvent*) pEvent {
    IMouseInfo info;
    [self getMouseXY:pEvent : info.x : info.y];
    int mods = (int) [pEvent modifierFlags];

    info.ms = IMouseMod(([pEvent type] == NSEventTypeLeftMouseDown) || ([pEvent type] == NSEventTypeLeftMouseDragged),
                        (mods & NSCommandKeyMask),
                        (mods & NSShiftKeyMask),
                        (mods & NSControlKeyMask),
                        (mods & NSAlternateKeyMask));

    return info;
}

Updated `getMouseLeft` in `IGraphicsMac_view.mm` to correctly determine the state of the left mouse button based on `NSEvent`. This change ensures that `info.ms.L` accurately reflects whether the left mouse button is pressed
Copy link

@filipeborato filipeborato left a comment

Choose a reason for hiding this comment

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

I tested this fix and it seems to be correct.

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.

None yet

2 participants