[Fix] Generic touch now can unfocus gui control correctly.
authorulion <ulion2002@gmail.com>
Sat, 23 Mar 2013 03:18:46 +0000 (11:18 +0800)
committerulion <ulion2002@gmail.com>
Wed, 3 Apr 2013 22:09:23 +0000 (06:09 +0800)
xbmc/Application.cpp
xbmc/input/touch/generic/GenericTouchActionHandler.cpp
xbmc/windowing/osx/WinEventsIOS.mm

index c3358ca..73963f7 100644 (file)
@@ -543,6 +543,12 @@ bool CApplication::OnEvent(XBMC_Event& newEvent)
         return false;
 
       CApplicationMessenger::Get().SendAction(CAction(actionId, 0, newEvent.touch.x, newEvent.touch.y, newEvent.touch.x2, newEvent.touch.y2), windowId, false);
+      // Post an unfocus message for touch device after the action.
+      if (newEvent.touch.action == ACTION_GESTURE_END || newEvent.touch.action == ACTION_TOUCH_TAP)
+      {
+        CGUIMessage msg(GUI_MSG_UNFOCUS_ALL, 0, 0, 0, 0);
+        CApplicationMessenger::Get().SendGUIMessage(msg);
+      }
       break;
     }
   }
index 3cd1065..6127602 100644 (file)
@@ -93,9 +93,6 @@ bool CGenericTouchActionHandler::OnTouchGestureEnd(float x, float y, float offse
 {
   sendEvent(ACTION_GESTURE_END, velocityX, velocityY, x, y);
 
-  // unfocus the focused GUI item
-  g_windowManager.SendMessage(GUI_MSG_UNFOCUS_ALL, 0, 0, 0, 0);
-
   return true;
 }
 
index 8b6edd4..a2f31cd 100644 (file)
@@ -82,16 +82,7 @@ bool CWinEventsIOS::MessagePump()
     }
     else
       ret |= g_application.OnEvent(pumpEvent);
-
-//on ios touch devices - unfocus controls on finger lift
-#if !defined(TARGET_DARWIN_IOS_ATV2)
-    if (pumpEvent.type == XBMC_MOUSEBUTTONUP)
-    {
-      g_windowManager.SendMessage(GUI_MSG_UNFOCUS_ALL, 0, 0, 0, 0);
-    }
-#endif
   }
-
   return ret;
 }