Detect when we open the iOS Control or Notification Center

Hello everyone :slight_smile:

I’m wondering if it’s possible to detect when we open the iOS Control (swipe up from screen bottom) or Notification (swipe down from screen top) center in a SDL application.

To handle touch events properly, I need to store data of a SDL_FINGERDOWN event, and I release them when SDL triggers a SDL_FINGERUP event.
Thus, I now exactly how many fingers there are on the screen at any moment.

The problem is that when I open the Control Center (with a swipe up gesture from the bottom part of the screen), SDL fires a SDL_FINGERDOWN event but when the Control Center window appears, we are not into the application anymore for iOS, so if we remove our finger, SDL won’t trigger a SDL_FINGERUP event and my SDL application considers that there is still a finger on the screen.

I tried to find a solution using SDL_WindowEvent like SDL_WINDOWEVENT_FOCUS_LOST or SDL_WINDOWEVENT_LEAVE, but they are not fired when we open the Control or Notification center.

Is somebody already encountered this issue?

Thanks a lot for reading me [Wink]

SDL?s code sends a SDL_FINGERUP event when iOS ?cancels? a touch press, which is what should happen when the Control Center or Today View menus are opened. It works as expected on my phone, at least.

What versions of SDL and iOS are you using?> On Nov 19, 2015, at 2:05 PM, Noxalus wrote:

Hello everyone

I’m wondering if it’s possible to detect when we open the iOS Control (swipe up from screen bottom) or Notification (swipe down from screen top) center in a SDL application.

To handle touch events properly, I need to store data of a SDL_FINGERDOWN event, and I release them when SDL triggers a SDL_FINGERUP event.
Thus, I now exactly how many fingers there are on the screen at any moment.

The problem is that when I open the Control Center (with a swipe up gesture from the bottom part of the screen), SDL fires a SDL_FINGERDOWN event but when the Control Center window appears, we are not into the application anymore for iOS, so if we remove our finger, SDL won’t trigger a SDL_FINGERUP event and my SDL application considers that there is still a finger on the screen.

I tried to find a solution using SDL_WindowEvent like SDL_WINDOWEVENT_FOCUS_LOST or SDL_WINDOWEVENT_LEAVE, but they are not fired when we open the Control or Notification center.

Is somebody already encountered this issue?

Thanks a lot for reading me


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello Alex and thank you for your answer.

I’m currently using SDL 2.0.3 and tested it on iOS 8.4.1, and you are right, SDL properly triggers a SDL_FINGERUP when we open the Control or Notification center. My tests were wrong because I used a web view on top of my SDL canvas.

When we open these menus, a JS touchend event should be fired and transmitted to the SDL canvas.

So, actually, this issue doesn’t concern SDL, I’m sorry. [Embarassed]

Thank you for your help anyway! [Wink]

I’m come back because I think this problem can’t be resolved using JS.

The idea that I had was to add an event listener on JS event triggered when the window loses the focus (‘blur’ event and ‘focus’ for the opposite).

Unfortunatly, these events are not fired when we open the Control Center like I expected.

But if SDL can detect that to trigger an SDL_FINGERUP event, it should also fire a SDL_WindowEvent (https://wiki.libsdl.org/SDL_WindowEvent) like SDL_WINDOWEVENT_FOCUS_LOST.

And this is what SDL do, so there is no problem, everything is good. :smiley: