The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Detect when we open the iOS Control or Notification Center
Noxalus


Joined: 06 Mar 2014
Posts: 26
Location: France
Hello everyone 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
Detect when we open the iOS Control or Notification Center
Alex Szpakowski
Guest

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?
Quote:
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 mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Noxalus


Joined: 06 Mar 2014
Posts: 26
Location: France
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. Embarrassed

Thank you for your help anyway! Wink
Noxalus


Joined: 06 Mar 2014
Posts: 26
Location: France
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 like SDL_WINDOWEVENT_FOCUS_LOST.

And this is what SDL do, so there is no problem, everything is good. Very Happy