part of dealing with work is platform independent, so moved it to platform independen...
[freeglut] / src / android / fg_main_android.c
index 1fa41d6..77e43b3 100644 (file)
@@ -488,45 +488,24 @@ void fgPlatformMainLoopPreliminaryWork ( void )
 }\r
 \r
 \r
-/* Step through the work list */\r
-void fgPlatformProcessWork(SFG_Window *window)\r
+/* deal with work list items */\r
+void fgPlatformInitWork(SFG_Window* window)\r
 {\r
-    unsigned int workMask = window->State.WorkMask;\r
-    /* Now clear it so that any callback generated by the actions below can set work again */\r
-    window->State.WorkMask = 0;\r
+    /* notify windowStatus/visibility */\r
+    INVOKE_WCB( *window, WindowStatus, ( GLUT_FULLY_RETAINED ) );\r
 \r
-    if (workMask&~GLUT_DISPLAY_WORK)    /* Display work is the common case, skip all the below at once */\r
-    {\r
-    /* This is before the first display callback: call a few callbacks to inform user of window size, position, etc\r
-     * we know this is before the first display callback of a window as for all windows GLUT_INIT_WORK is set when\r
-     * they are opened, and work is done before displaying in the mainloop.\r
+    /* Position callback, always at 0,0 */\r
+    fghOnPositionNotify(window, 0, 0, GL_TRUE);\r
+\r
+    /* Size gets notified on window creation with size detection in mainloop above\r
+     * XXX CHECK: does this messages happen too early like on windows,\r
+     * so client code cannot have registered a callback yet and the message\r
+     * is thus never received by client?\r
      */\r
-    if (workMask & GLUT_INIT_WORK)\r
-    {\r
-        /* notify windowStatus/visibility */\r
-        INVOKE_WCB( *window, WindowStatus, ( GLUT_FULLY_RETAINED ) );\r
-\r
-        /* Position callback, always at 0,0 */\r
-        fghOnPositionNotify(window, 0, 0, GL_TRUE);\r
-\r
-        /* Size gets notified on window creation with size detection in mainloop above\r
-         * XXX CHECK: does this messages happen too early like on windows,\r
-         * so client code cannot have registered a callback yet and the message\r
-         * is thus never received by client?\r
-         */\r
-\r
-        /* Call init context callback */\r
-        INVOKE_WCB( *window, InitContext, ());\r
-\r
-        /* Lastly, check if we have a display callback, error out if not\r
-         * This is the right place to do it, as the redisplay will be\r
-         * next right after we exit this function, so there is no more\r
-         * opportunity for the user to register a callback for this window.\r
-         */\r
-        if (!FETCH_WCB(*window, Display))\r
-            fgError ( "ERROR:  No display callback registered for window %d\n", window->ID );\r
-    }\r
+}\r
 \r
+void fgPlatformPosResZordWork(SFG_Window* window, unsigned int workMask)\r
+{\r
     if (workMask & GLUT_FULL_SCREEN_WORK)\r
         fgPlatformFullScreenToggle( window );\r
     if (workMask & GLUT_POSITION_WORK)\r
@@ -540,39 +519,29 @@ void fgPlatformProcessWork(SFG_Window *window)
         else\r
             fgPlatformPopWindow( window );\r
     }\r
+}\r
 \r
-    if (workMask & GLUT_VISIBILITY_WORK)\r
-    {\r
-        /* Visibility status of window should get updated in the window message handlers\r
-         * For now, none of these functions called below do anything, so don't worry\r
-         * about it\r
-         */\r
-        SFG_Window *win = window;\r
-        switch (window->State.DesiredVisibility)\r
-        {\r
-        case DesireHiddenState:\r
-            fgPlatformHideWindow( window );\r
-            break;\r
-        case DesireIconicState:\r
-            /* Call on top-level window */\r
-            while (win->Parent)\r
-                win = win->Parent;\r
-            fgPlatformIconifyWindow( win );\r
-            break;\r
-        case DesireNormalState:\r
-            fgPlatformShowWindow( window );\r
-            break;\r
-        }\r
-    }\r
-    }\r
-\r
-    if (workMask & GLUT_DISPLAY_WORK)\r
+void fgPlatformVisibilityWork(SFG_Window* window)\r
+{\r
+    /* Visibility status of window should get updated in the window message handlers\r
+     * For now, none of these functions called below do anything, so don't worry\r
+     * about it\r
+     */\r
+    SFG_Window *win = window;\r
+    switch (window->State.DesiredVisibility)\r
     {\r
-        if( window->State.Visible )\r
-            fghRedrawWindow ( window );\r
-\r
-        /* Strip out display work that might have ended up on work list now as some of the above genereates callbacks */\r
-        window->State.WorkMask &= ~GLUT_DISPLAY_WORK;\r
+    case DesireHiddenState:\r
+        fgPlatformHideWindow( window );\r
+        break;\r
+    case DesireIconicState:\r
+        /* Call on top-level window */\r
+        while (win->Parent)\r
+            win = win->Parent;\r
+        fgPlatformIconifyWindow( win );\r
+        break;\r
+    case DesireNormalState:\r
+        fgPlatformShowWindow( window );\r
+        break;\r
     }\r
 }\r
 \r