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 - [PATCH] SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH=1 is broken on SDL_WINDOW_METAL windows
Summary: [PATCH] SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH=1 is broken on SDL_WINDOW_METAL win...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 macOS 10.15
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-05 22:07 UTC by Cameron Gutman
Modified: 2020-09-08 15:41 UTC (History)
0 users

See Also:


Attachments
Patch (1.43 KB, patch)
2020-09-05 22:07 UTC, Cameron Gutman
Details | Diff
Patch v2 (1.26 KB, patch)
2020-09-05 22:10 UTC, Cameron Gutman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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