[Libreoffice-commits] .: Branch 'feature/android' - vcl/android vcl/inc

Michael Meeks michael at kemper.freedesktop.org
Thu Jan 26 07:00:30 PST 2012


 vcl/android/androidinst.cxx     |   17 +++++++++++------
 vcl/inc/android/androidinst.hxx |    2 +-
 2 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 0c2de3df0982b0c77987c640a9af38d310325a55
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Jan 26 14:36:25 2012 +0000

    android: get at least something onto the screen

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index d867fa8..d8ba0b0 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -152,6 +152,7 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow)
         SvpSalFrame *pFrame = static_cast<SvpSalFrame *>(*it);
         BlitFrameToWindow (pWindow, pFrame->getDevice());
     }
+    mbQueueReDraw = false;
 }
 
 void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd)
@@ -167,7 +168,6 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd)
             fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n",
                      pWindow, aRect.right, aRect.bottom,
                      ANativeWindow_getFormat(pWindow));
-            mbQueueReDraw = true;
             break;
         }
         case APP_CMD_WINDOW_RESIZED:
@@ -178,12 +178,12 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd)
             fprintf (stderr, "app window resized to ! %p %dx%x (%d)\n",
                      pWindow, aRect.right, aRect.bottom,
                      ANativeWindow_getFormat(pWindow));
-            mbQueueReDraw = true;
             break;
         }
 
         case APP_CMD_WINDOW_REDRAW_NEEDED:
         {
+            fprintf (stderr, "redraw needed\n");
             mbQueueReDraw = true;
             break;
         }
@@ -248,15 +248,21 @@ AndroidSalInstance *AndroidSalInstance::getInstance()
 }
 
 extern "C" {
-    void onAppCmd_cb (struct android_app* app, int32_t cmd)
+    void onAppCmd_cb (struct android_app *app, int32_t cmd)
     {
         AndroidSalInstance::getInstance()->onAppCmd(app, cmd);
     }
 
-    int32_t onInputEvent_cb (struct android_app* app, AInputEvent* event)
+    int32_t onInputEvent_cb (struct android_app *app, AInputEvent *event)
     {
         return AndroidSalInstance::getInstance()->onInputEvent(app, event);
     }
+    void onNativeWindowRedrawNeeded_cb(ANativeActivity * /* activity */,
+                                       ANativeWindow *pWindow)
+    {
+        fprintf (stderr, "onNativeWindowRedrawNeeded_cb\n");
+        AndroidSalInstance::getInstance()->RedrawWindows (pWindow);
+    }
 }
 
 AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex )
@@ -275,6 +281,7 @@ AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex )
         mpApp->onInputEvent = onInputEvent_cb;
         if (mpApp->window != NULL)
             onAppCmd_cb (mpApp, APP_CMD_INIT_WINDOW);
+        mpApp->activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded_cb;
         pthread_mutex_unlock (&mpApp->mutex);
     }
 }
@@ -317,8 +324,6 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS)
         mpApp->cmdPollSource.process(mpApp, &mpApp->cmdPollSource);
     else if (nRet == LOOPER_ID_INPUT)
         mpApp->inputPollSource.process(mpApp, &mpApp->inputPollSource);
-    else if (mbQueueReDraw)
-        RedrawWindows (mpApp->window);
 }
 
 bool AndroidSalInstance::AnyInput( sal_uInt16 nType )
diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx
index e39f147..8efb963 100644
--- a/vcl/inc/android/androidinst.hxx
+++ b/vcl/inc/android/androidinst.hxx
@@ -37,7 +37,6 @@
 
 class AndroidSalInstance : public SvpSalInstance
 {
-    void RedrawWindows(ANativeWindow *pWindow);
     void BlitFrameToWindow(ANativeWindow *pWindow,
                            const basebmp::BitmapDeviceSharedPtr& aDev);
 public:
@@ -54,6 +53,7 @@ public:
     // incoming android event handlers:
     void    onAppCmd     (struct android_app* app, int32_t cmd);
     int32_t onInputEvent (struct android_app* app, AInputEvent* event);
+    void    RedrawWindows(ANativeWindow *pWindow);
 protected:
     virtual void DoReleaseYield( int nTimeoutMS );
     struct android_app *mpApp;


More information about the Libreoffice-commits mailing list