Skip to content

Commit

Permalink
Fixed mouse event forwarding in macos example (#2710, #1961)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Sep 20, 2019
1 parent 38d22bc commit f7468d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Other Changes:
- Backends: Vulkan: Added support for specifying multisample count.
Set ImGui_ImplVulkan_InitInfo::MSAASamples to one of the VkSampleCountFlagBits values
to use, default is non-multisampled as before. (#2705, #2706) [@vilya]
- Examples: OSX: Fix example_apple_opengl2/main.mm not forwarding mouse clicks and drags correctly. (#1961, #2710)
[@intonarumori, @ElectricMagic]
- Misc: Updated stb_rect_pack from 0.99 to 1.00 (fixes by @rygorous: off-by-1 bug in best-fit heuristic,
fix handling of rectangles too large to fit inside texture). (#2762) [@tido64]

Expand Down
9 changes: 3 additions & 6 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

0 comments on commit f7468d0

Please sign in to comment.