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 #1

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

janhase88
Copy link
Owner

@janhase88 janhase88 commented Nov 9, 2023

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
@janhase88 janhase88 merged commit be44fbc into master Jun 1, 2024
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.

1 participant