use onWindowFocusChanged(bool) instead of onResume()/onPause()

we should use onWindowFocusChanged(bool) to detect if the app is currently
visitible to the user or not. because onPause()/onResume() leads to false
positives on some android versions (e.g. Kindle Fire). if you lock those
devices, while the app running, everything is fine (onPause() is handled
properly). but as soon as you wake up the device, and the lock screen gets
visible, the app is resumed and the music is played (onResume() is
called to early).

this is a) not the best behaviour and b) such games will be rejected on the
samsung app store. onWindowFocusChanged(bool) is, like onPause()/onResume(),
available since API level 1 and it should be safe to simply switch.
Merge pull request #4 from cocos2d/master

Merge from the latest version of cocos2d
Added config macro for "spine" extension
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into develop
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into develop
fix CCScale9Sprite CapInsets bug for rotated sprite frame
CocosDenshion: fixed wrong assertion in android OpenSL engine

Playback rate interface cannot be initialized for some players in
android 4.x, it's not cocos2d bug.
Solving 'black screen' on android
Now opacity option for shadow in CCLabelTTF works.
fixing Linux build
Add append function for String class.

The append function is useful when adding a string.
So, I added it to String class.
issue #2389: Adding cookie support for HttpClient
issue #2300: A fix of missing invoking 'initXXX' in clone method.(FadeOut, DelayTime).
'tile' --> 'getTile', 'orignalTile' --> 'getOrignalTile'
issue  #2377:add scriptHandlerMgr and modify ActionManager.lua
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into ScriptHandler
closed issue #2386 : Fix bug : add a new method to clear the stencil buffer bit used by ClippingNode
enableCookies is static method now
Merge pull request #3124 from dumganhar/rename-method

issue #2300: A fix of missing invoking 'initXXX' in clone method.(FadeOut, DelayTime).
Merge pull request #3125 from dabingnn/Iss2386-ClippingNode-AsChild-Bug

closed issue #2386 : ClippingNode works wrongly when being set as a child