Skip to content

Commit

Permalink
[iOS DAC] Fix touch events getting from SDL2 to source2.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 12, 2019
1 parent d05eec7 commit 82758ef
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/video/uikit/SDL_uikitview.m
Expand Up @@ -82,6 +82,27 @@ - (instancetype)initWithFrame:(CGRect)frame
return self;
}

- (void)layoutSubviews
{
// Fix for touch ios.
#if TARGET_OS_IOS
// on ios, a metal view gets added to our parent, and covers this for touch events.
// So set ourselves to user interact, and siblings false. johna
NSArray<UIView*>* subviews = [self.superview subviews];
for (int i=0; i<[subviews count]; i++)
{
UIView *view = [subviews objectAtIndex:i];
if (view == self) {
[view setUserInteractionEnabled:YES]; // set our user interaction to true.
} else {
[view setUserInteractionEnabled:NO]; // siblings to false.
}
}
#endif
[super layoutSubviews];
}


- (void)setSDLWindow:(SDL_Window *)window
{
SDL_WindowData *data = nil;
Expand Down

0 comments on commit 82758ef

Please sign in to comment.