mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-17 00:44:19 +00:00
Android windowing fix.
This commit is contained in:
parent
10a388a9e8
commit
151ec34375
1 changed files with 15 additions and 11 deletions
|
|
@ -86,11 +86,15 @@ class AndroidComponentPeer : public ComponentPeer
|
|||
public:
|
||||
AndroidComponentPeer (Component* const component, const int windowStyleFlags)
|
||||
: ComponentPeer (component, windowStyleFlags),
|
||||
view (android.activity.callObjectMethod (JuceAppActivity.createNewView, component->isOpaque())),
|
||||
usingAndroidGraphics (false),
|
||||
fullScreen (false),
|
||||
sizeAllocated (0)
|
||||
{
|
||||
// NB: must not put this in the initialiser list, as it invokes a callback,
|
||||
// which will fail if the peer is only half-constructed.
|
||||
view = GlobalRef (android.activity.callObjectMethod (JuceAppActivity.createNewView,
|
||||
component->isOpaque()));
|
||||
|
||||
if (isFocused())
|
||||
handleFocusGain();
|
||||
}
|
||||
|
|
@ -474,14 +478,14 @@ public:
|
|||
#endif
|
||||
|
||||
//==============================================================================
|
||||
static AndroidComponentPeer* findPeerForJavaView (jobject viewToFind)
|
||||
static AndroidComponentPeer* findPeerForJavaView (JNIEnv* env, jobject viewToFind)
|
||||
{
|
||||
for (int i = getNumPeers(); --i >= 0;)
|
||||
{
|
||||
AndroidComponentPeer* const ap = static_cast <AndroidComponentPeer*> (getPeer(i));
|
||||
jassert (dynamic_cast <AndroidComponentPeer*> (getPeer(i)) != 0);
|
||||
jassert (dynamic_cast <AndroidComponentPeer*> (getPeer(i)) != nullptr);
|
||||
|
||||
if (ap->view == viewToFind)
|
||||
if (env->IsSameObject (ap->view.get(), viewToFind))
|
||||
return ap;
|
||||
}
|
||||
|
||||
|
|
@ -560,17 +564,17 @@ Point<int> AndroidComponentPeer::lastMousePos;
|
|||
#define JUCE_VIEW_CALLBACK(returnType, javaMethodName, params, juceMethodInvocation) \
|
||||
JUCE_JNI_CALLBACK (ComponentPeerView, javaMethodName, returnType, params) \
|
||||
{ \
|
||||
AndroidComponentPeer* const peer = AndroidComponentPeer::findPeerForJavaView (view); \
|
||||
AndroidComponentPeer* const peer = AndroidComponentPeer::findPeerForJavaView (env, view); \
|
||||
if (peer != nullptr) \
|
||||
peer->juceMethodInvocation; \
|
||||
}
|
||||
|
||||
JUCE_VIEW_CALLBACK (void, handlePaint, (JNIEnv* env, jobject view, jobject canvas), handlePaintCallback (env, canvas))
|
||||
JUCE_VIEW_CALLBACK (void, handleMouseDown, (JNIEnv*, jobject view, jfloat x, jfloat y, jlong time), handleMouseDownCallback ((float) x, (float) y, (int64) time))
|
||||
JUCE_VIEW_CALLBACK (void, handleMouseDrag, (JNIEnv*, jobject view, jfloat x, jfloat y, jlong time), handleMouseDragCallback ((float) x, (float) y, (int64) time))
|
||||
JUCE_VIEW_CALLBACK (void, handleMouseUp, (JNIEnv*, jobject view, jfloat x, jfloat y, jlong time), handleMouseUpCallback ((float) x, (float) y, (int64) time))
|
||||
JUCE_VIEW_CALLBACK (void, viewSizeChanged, (JNIEnv*, jobject view), handleMovedOrResized())
|
||||
JUCE_VIEW_CALLBACK (void, focusChanged, (JNIEnv*, jobject view, jboolean hasFocus), handleFocusChangeCallback (hasFocus))
|
||||
JUCE_VIEW_CALLBACK (void, handlePaint, (JNIEnv* env, jobject view, jobject canvas), handlePaintCallback (env, canvas))
|
||||
JUCE_VIEW_CALLBACK (void, handleMouseDown, (JNIEnv* env, jobject view, jfloat x, jfloat y, jlong time), handleMouseDownCallback ((float) x, (float) y, (int64) time))
|
||||
JUCE_VIEW_CALLBACK (void, handleMouseDrag, (JNIEnv* env, jobject view, jfloat x, jfloat y, jlong time), handleMouseDragCallback ((float) x, (float) y, (int64) time))
|
||||
JUCE_VIEW_CALLBACK (void, handleMouseUp, (JNIEnv* env, jobject view, jfloat x, jfloat y, jlong time), handleMouseUpCallback ((float) x, (float) y, (int64) time))
|
||||
JUCE_VIEW_CALLBACK (void, viewSizeChanged, (JNIEnv* env, jobject view), handleMovedOrResized())
|
||||
JUCE_VIEW_CALLBACK (void, focusChanged, (JNIEnv* env, jobject view, jboolean hasFocus), handleFocusChangeCallback (hasFocus))
|
||||
|
||||
//==============================================================================
|
||||
ComponentPeer* Component::createNewPeer (int styleFlags, void*)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue