summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-02-01 12:16:30 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-02-01 12:16:30 +0000
commitd663871cc701926a42fd3465e44fd4fc894fc30e (patch)
treeac4505133e5dcef02af7bdc1de270451af76d327 /vcl
parentc94c9dbdcfc8435f0df61fd326dc25d39d3c44cb (diff)
android: queue redraw on keypress (for now), and get the ALooper loop right
Diffstat (limited to 'vcl')
-rw-r--r--vcl/android/androidinst.cxx39
1 files changed, 15 insertions, 24 deletions
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index dfb885518560..6d70471e035f 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -271,7 +271,9 @@ void AndroidSalInstance::BlitFrameToWindow(ANativeWindow_Buffer *pOutBuffer,
void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow)
{
- (void)pWindow;
+ if (!pWindow)
+ return;
+
ANativeWindow_Buffer aOutBuffer;
memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer));
@@ -439,6 +441,9 @@ int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent*
bHandled = pFocus->CallCallback( nEvent, &aEvent );
else
fprintf (stderr, "no focused frame to emit event on\n");
+
+ // FIXME: queueing full re-draw on key events ...
+ mbQueueReDraw = true;
break;
}
case AINPUT_EVENT_TYPE_MOTION:
@@ -529,9 +534,8 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS)
// release yield mutex
sal_uLong nAcquireCount = ReleaseYieldMutex();
- fprintf (stderr, "DoReleaseYield #2 %d thread: %d ms\n",
+ fprintf (stderr, "DoReleaseYield #3 %d thread: %d ms\n",
nTimeoutMS, (int)pthread_self());
-#ifndef PLASMA
struct android_poll_source *pSource = NULL;
int outFd = 0, outEvents = 0;
@@ -540,34 +544,21 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS)
nTimeoutMS = 0;
int nRet;
- while ((nRet = ALooper_pollAll (nTimeoutMS, &outFd, &outEvents, (void**)&pSource)) >= 0)
- {
- fprintf (stderr, "ret #5 %d %d %d %p\n", nRet, outFd, outEvents, pSource);
- // acquire yield mutex again
- AcquireYieldMutex(nAcquireCount);
+ nRet = ALooper_pollAll (nTimeoutMS, &outFd, &outEvents, (void**)&pSource);
+ fprintf (stderr, "ret #6 %d %d %d %p\n", nRet, outFd, outEvents, pSource);
+ // acquire yield mutex again
+ AcquireYieldMutex(nAcquireCount);
+
+ if (nRet >= 0)
+ {
// Process this event.
if (pSource != NULL)
pSource->process(mpApp, pSource);
-
- nAcquireCount = ReleaseYieldMutex();
}
- // acquire yield mutex again
- AcquireYieldMutex(nAcquireCount);
-
- if (mbQueueReDraw)
+ if (mbQueueReDraw && mpApp->window)
AndroidSalInstance::getInstance()->RedrawWindows (mpApp->window);
-
-#else
- static int nPlasma = 0;
- char buffer[128];
- sprintf (buffer, "yield %d", nPlasma++);
- plasma_now(buffer);
-
- // acquire yield mutex again
- AcquireYieldMutex(nAcquireCount);
-#endif
}
bool AndroidSalInstance::AnyInput( sal_uInt16 nType )