ecere/gui/drivers/AndroidInterface: Fixed screen rotation
authorJerome St-Louis <jerome@ecere.com>
Mon, 3 Feb 2014 21:42:00 +0000 (04:42 +0700)
committerJerome St-Louis <jerome@ecere.com>
Mon, 3 Feb 2014 21:42:00 +0000 (04:42 +0700)
- Querying NativeWindow width & height even when ALooper_pollAll() did not return anything, otherwise the new values were not picked up until the next event

ecere/src/gui/drivers/AndroidInterface.ec

index 16c1cc1..3e400fa 100644 (file)
@@ -574,6 +574,20 @@ class AndroidInterface : Interface
 
       if(androidActivity.ident < 0)
          androidActivity.ident = (LooperID)ALooper_pollAll(0, null, &androidActivity.events, (void**)&androidActivity.source);
+
+      if(gotInit && androidActivity.window)
+      {
+         int w = ANativeWindow_getWidth(androidActivity.window);
+         int h = ANativeWindow_getHeight(androidActivity.window);
+         if(desktopW != w || desktopH != h)
+         {
+            guiApp.SetDesktopPosition(0, 0, w, h, true);
+            desktopW = w;
+            desktopH = h;
+            guiApp.desktop.Update(null);
+         }
+      }
+
       while(androidActivity.ident >= 0)
       {
          AndroidPollSource source = androidActivity.source;
@@ -594,18 +608,6 @@ class AndroidInterface : Interface
             }
          }
          */
-         if(gotInit && androidActivity.window)
-         {
-            int w = ANativeWindow_getWidth(androidActivity.window);
-            int h = ANativeWindow_getHeight(androidActivity.window);
-            if(desktopW != w || desktopH != h)
-            {
-               guiApp.SetDesktopPosition(0, 0, w, h, true);
-               desktopW = w;
-               desktopH = h;
-               guiApp.desktop.Update(null);
-            }
-         }
 
          eventAvailable = true;
          if(androidActivity.destroyRequested)