| @@ -138,6 +138,7 @@ public: | |||||
| { | { | ||||
| if (MessageManager::getInstance()->isThisTheMessageThread()) | if (MessageManager::getInstance()->isThisTheMessageThread()) | ||||
| { | { | ||||
| frontWindow = nullptr; | |||||
| android.activity.callVoidMethod (JuceAppActivity.deleteView, view.get()); | android.activity.callVoidMethod (JuceAppActivity.deleteView, view.get()); | ||||
| } | } | ||||
| else | else | ||||
| @@ -365,7 +366,13 @@ public: | |||||
| void toFront (bool makeActive) override | void toFront (bool makeActive) override | ||||
| { | { | ||||
| view.callVoidMethod (ComponentPeerView.bringToFront); | |||||
| // Avoid calling bringToFront excessively: it's very slow | |||||
| if (frontWindow != this) | |||||
| { | |||||
| view.callVoidMethod (ComponentPeerView.bringToFront); | |||||
| frontWindow = this; | |||||
| } | |||||
| if (makeActive) | if (makeActive) | ||||
| grabFocus(); | grabFocus(); | ||||
| @@ -571,6 +578,7 @@ private: | |||||
| bool usingAndroidGraphics, fullScreen; | bool usingAndroidGraphics, fullScreen; | ||||
| int sizeAllocated; | int sizeAllocated; | ||||
| float scale; | float scale; | ||||
| static AndroidComponentPeer* frontWindow; | |||||
| struct PreallocatedImage : public ImagePixelData | struct PreallocatedImage : public ImagePixelData | ||||
| { | { | ||||
| @@ -629,6 +637,7 @@ private: | |||||
| ModifierKeys AndroidComponentPeer::currentModifiers = 0; | ModifierKeys AndroidComponentPeer::currentModifiers = 0; | ||||
| Point<float> AndroidComponentPeer::lastMousePos; | Point<float> AndroidComponentPeer::lastMousePos; | ||||
| int64 AndroidComponentPeer::touchesDown = 0; | int64 AndroidComponentPeer::touchesDown = 0; | ||||
| AndroidComponentPeer* AndroidComponentPeer::frontWindow = nullptr; | |||||
| //============================================================================== | //============================================================================== | ||||
| #define JUCE_VIEW_CALLBACK(returnType, javaMethodName, params, juceMethodInvocation) \ | #define JUCE_VIEW_CALLBACK(returnType, javaMethodName, params, juceMethodInvocation) \ | ||||