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 for mouse event forwarding in MacOS example #2710

Closed
Changes from all commits
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
11 changes: 4 additions & 7 deletions examples/example_apple_opengl2/main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ -(BOOL)resignFirstResponder
return (YES);
}

// Flip coordinate system upside down on Y
-(BOOL)isFlipped
{
return (YES);
}

-(void)dealloc
{
animationTimer = nil;
Expand All @@ -150,6 +144,8 @@ -(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); }
-(void)mouseDragged:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }
-(void)scrollWheel:(NSEvent *)event { ImGui_ImplOSX_HandleEvent(event, self); }

@end
Expand Down Expand Up @@ -179,6 +175,7 @@ -(NSWindow*)window

_window = [[NSWindow alloc] initWithContentRect:viewRect styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable|NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:YES];
[_window setTitle:@"Dear ImGui OSX+OpenGL2 Example"];
[_window setAcceptsMouseMovedEvents:YES];
[_window setOpaque:YES];
[_window makeKeyAndOrderFront:NSApp];

Expand Down Expand Up @@ -233,7 +230,7 @@ -(void)applicationDidFinishLaunching:(NSNotification *)aNotification
[view setWantsBestResolutionOpenGLSurface:YES];
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
[self.window setContentView:view];

if ([view openGLContext] == nil)
NSLog(@"No OpenGL Context!");

Expand Down