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

Fix OSX mouse clicks and drags #1961

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion examples/example_apple_opengl2/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ -(BOOL)resignFirstResponder
// Flip coordinate system upside down on Y

Choose a reason for hiding this comment

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

The comment is not correct anymore. Instead of returning NO you could remove 'isFlipped' method completely.

-(BOOL)isFlipped
{
return (YES);
return (NO);
}

-(void)dealloc
Expand All @@ -150,6 +150,20 @@ -(void)keyDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self)
-(void)flagsChanged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)mouseDown:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)mouseUp:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)mouseMoved:(NSEvent *)event
{
ImGui_ImplOSX_HandleEvent(event, self);
[super mouseMoved: event];

}

-(void)mouseDragged:(NSEvent *)event
{
ImGui_ImplOSX_HandleEvent(event, self);
[super mouseMoved: event];

}

-(void)scrollWheel:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }

@end
Expand Down Expand Up @@ -182,6 +196,8 @@ -(NSWindow*)window
[_window setOpaque:YES];
[_window makeKeyAndOrderFront:NSApp];

[_window setAcceptsMouseMovedEvents:YES];

return (_window);
}

Expand Down