We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5282

Summary: [PATCH] SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH=1 is broken on SDL_WINDOW_METAL windows
Product: SDL Reporter: Cameron Gutman <cameron.gutman>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: macOS 10.15   
Attachments: Patch
Patch v2

Description Cameron Gutman 2020-09-05 22:07:07 UTC
When SDL_WINDOW_METAL is passed during window creation, a SDL_cocoametalview subview is added to the view hierarchy. Unfortunately, this view is not fully transparent to mouse button events. It eats the focus click event that should be propagated to SDLView to make SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH=1 work.

Overriding [NSView hitTest] to always return nil makes the view properly transparent to mouse buttons events. https://developer.apple.com/documentation/appkit/nsview/1483364-hittest?language=objc
Comment 1 Cameron Gutman 2020-09-05 22:07:39 UTC
Created attachment 4458 [details]
Patch
Comment 2 Cameron Gutman 2020-09-05 22:10:25 UTC
Created attachment 4459 [details]
Patch v2

Whoops, forgot to remove an extra SDL_hints.h include in the patch. Fixed
Comment 3 Sam Lantinga 2020-09-08 15:41:00 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/ae5fbcbde643