sdk: const correctness
[sdk] / ecere / src / gui / drivers / AndroidInterface.ec
index e75c8a0..6764e72 100644 (file)
@@ -327,7 +327,7 @@ private:
          savedStateSize = 0;
    }
 
-   void Create()
+   public void Create()
    {
       int msgpipe[2];
       if(pipe(msgpipe))
@@ -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,6 +608,7 @@ class AndroidInterface : Interface
             }
          }
          */
+
          eventAvailable = true;
          if(androidActivity.destroyRequested)
          {
@@ -625,11 +640,11 @@ class AndroidInterface : Interface
 
    }
 
-   char ** GraphicsDrivers(int * numDrivers)
+   const char ** GraphicsDrivers(int * numDrivers)
    {
-      static char *graphicsDrivers[] = { "OpenGL" };
+      static const char *graphicsDrivers[] = { "OpenGL" };
       *numDrivers = sizeof(graphicsDrivers) / sizeof(char *);
-      return (char **)graphicsDrivers;
+      return (const char **)graphicsDrivers;
    }
 
    void GetCurrentMode(bool * fullScreen, int * resolution, int * colorDepth, int * refreshRate)
@@ -662,7 +677,7 @@ class AndroidInterface : Interface
 
    // -- Window manipulation ---
 
-   void SetRootWindowCaption(Window window, char * name)
+   void SetRootWindowCaption(Window window, const char * name)
    {
 
    }
@@ -764,7 +779,7 @@ class AndroidInterface : Interface
 
    // -- Mouse cursor ---
 
-   void SetMouseCursor(int cursor)
+   void SetMouseCursor(Window window, int cursor)
    {
       if(cursor == -1)
       {
@@ -781,7 +796,7 @@ class AndroidInterface : Interface
       if(window && window.windowData)
       {
       }
-   }  
+   }
 
    void ClearClipboard()
    {
@@ -795,7 +810,7 @@ class AndroidInterface : Interface
    {
       bool result = false;
       if((clipBoard.text = new0 byte[size]))
-         result = true;   
+         result = true;
       return result;
    }
 
@@ -867,7 +882,7 @@ class AndroidInterface : Interface
    void SetTimerResolution(uint hertz)
    {
       // timerDelay = hertz ? (1000000 / hertz) : MAXINT;
-   }  
+   }
 
    bool SetIcon(Window window, BitmapResource resource)
    {
@@ -1086,7 +1101,7 @@ class AndroidActivity : AndroidAppGlue
          //PrintLn("Got a motion input event: ", action);
          /*
          if(action == 8) //AMOTION_EVENT_ACTION_SCROLL)
-            axis = AMotionEvent_getAxisValue(event, 9, index); //AMOTION_EVENT_AXIS_VSCROLL); 
+            axis = AMotionEvent_getAxisValue(event, 9, index); //AMOTION_EVENT_AXIS_VSCROLL);
          */
 
          AInputQueue_finishEvent(inputQueue, event, 1);
@@ -1213,17 +1228,7 @@ class AndroidActivity : AndroidAppGlue
             break;
          case configChanged:
             if(window)
-            {
-               int w = ANativeWindow_getWidth(window);
-               int h = ANativeWindow_getHeight(window);
-               if(desktopW != w || desktopH != h)
-               {
-                  guiApp.SetDesktopPosition(0, 0, w, h, true);
-                  desktopW = w;
-                  desktopH = h;
-               }
-               guiApp.desktop.Update(null);
-            }
+               guiApp.desktop.UpdateDisplay();
             break;
       }
    }
@@ -1242,7 +1247,7 @@ class AndroidActivity : AndroidAppGlue
 
       {
          Module app;
-          
+
          // Evolve the Application class into a GuiApplication
          eInstance_Evolve((Instance *)&__androidCurrentModule, class(GuiApplication));