X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fandroid%2Ffg_main_android.c;h=41a1d3f4ecb2da64e4a2a71c908f76b8354d3fac;hb=6090a1ed96f3eb4c90f1f38ec9cd37ae0fe9b30e;hp=ce3f58540f1314b598cdb424bbceb125cd9bc16b;hpb=99d53f15a4216240088132f6af9cb194b519b1cc;p=freeglut diff --git a/src/android/fg_main_android.c b/src/android/fg_main_android.c index ce3f585..41a1d3f 100644 --- a/src/android/fg_main_android.c +++ b/src/android/fg_main_android.c @@ -330,7 +330,6 @@ void handle_cmd(struct android_app* app, int32_t cmd) { /* The window is being shown, get it ready. */ LOGI("handle_cmd: APP_CMD_INIT_WINDOW %p", app->window); fgDisplay.pDisplay.single_native_window = app->window; - window->State.WorkMask |= GLUT_INIT_WORK; /* start|resume: glPlatformOpenWindow was waiting for Handle to be defined and will now continue processing */ break; @@ -415,7 +414,7 @@ void fgPlatformProcessSingleEvent ( void ) if (window != NULL && window->Window.Handle != NULL) { int32_t width = ANativeWindow_getWidth(window->Window.Handle); int32_t height = ANativeWindow_getHeight(window->Window.Handle); - fghOnReshapeNotify(width,height); + fghOnReshapeNotify(window,width,height,GL_FALSE); } /* Read pending event. */ @@ -437,7 +436,7 @@ void fgPlatformProcessSingleEvent ( void ) /* If we're not in RESUME state, Android paused us, so wait */ struct android_app* app = fgDisplay.pDisplay.app; if (app->destroyRequested != 1 && app->activityState != APP_CMD_RESUME) { - INVOKE_WCB(*window, Pause, ()); + INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_PAUSE)); int FOREVER = -1; while (app->destroyRequested != 1 && (app->activityState != APP_CMD_RESUME)) { @@ -465,14 +464,14 @@ void fgPlatformProcessSingleEvent ( void ) * be not possible to ensure InitContext CB gets called before * Resume CB like that.. so maybe just force calling initContext CB * here is best. Or we could force work on the window in question.. - * 1) save old work mask, 2) set mask to init only, 3) call fgPlatformProcessWork directly + * 1) save old work mask, 2) set mask to init only, 3) call fgProcessWork directly * 4) set work mask back to the one saved in step 1. */ if (!FETCH_WCB(*window, InitContext)) fgWarning("Resuming application, but no callback to reload context resources (glutInitContextFunc)"); } - INVOKE_WCB(*window, Resume, ()); + INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_RESUME)); } } @@ -488,43 +487,24 @@ void fgPlatformMainLoopPreliminaryWork ( void ) } -/* Step through the work list */ -void fgPlatformProcessWork(SFG_Window *window) +/* deal with work list items */ +void fgPlatformInitWork(SFG_Window* window) { - unsigned int workMask = window->State.WorkMask; - /* Now clear it so that any callback generated by the actions below can set work again */ - window->State.WorkMask = 0; + /* notify windowStatus/visibility */ + INVOKE_WCB( *window, WindowStatus, ( GLUT_FULLY_RETAINED ) ); - /* This is before the first display callback: call a few callbacks to inform user of window size, position, etc - * we know this is before the first display callback of a window as for all windows GLUT_INIT_WORK is set when - * they are opened, and work is done before displaying in the mainloop. + /* Position callback, always at 0,0 */ + fghOnPositionNotify(window, 0, 0, GL_TRUE); + + /* Size gets notified on window creation with size detection in mainloop above + * XXX CHECK: does this messages happen too early like on windows, + * so client code cannot have registered a callback yet and the message + * is thus never received by client? */ - if (workMask & GLUT_INIT_WORK) - { - /* notify windowStatus/visibility */ - INVOKE_WCB( *window, WindowStatus, ( GLUT_FULLY_RETAINED ) ); - - /* Position callback, always at 0,0 */ - fghOnPositionNotify(window, 0, 0, GL_TRUE); - - /* Size gets notified on window creation with size detection in mainloop above - * XXX CHECK: does this messages happen too early like on windows, - * so client code cannot have registered a callback yet and the message - * is thus never received by client? - */ - - /* Call init context callback */ - INVOKE_WCB( *window, InitContext, ()); - - /* Lastly, check if we have a display callback, error out if not - * This is the right place to do it, as the redisplay will be - * next right after we exit this function, so there is no more - * opportunity for the user to register a callback for this window. - */ - if (!FETCH_WCB(*window, Display)) - fgError ( "ERROR: No display callback registered for window %d\n", window->ID ); - } +} +void fgPlatformPosResZordWork(SFG_Window* window, unsigned int workMask) +{ if (workMask & GLUT_FULL_SCREEN_WORK) fgPlatformFullScreenToggle( window ); if (workMask & GLUT_POSITION_WORK) @@ -538,29 +518,29 @@ void fgPlatformProcessWork(SFG_Window *window) else fgPlatformPopWindow( window ); } +} - if (workMask & GLUT_VISIBILITY_WORK) +void fgPlatformVisibilityWork(SFG_Window* window) +{ + /* Visibility status of window should get updated in the window message handlers + * For now, none of these functions called below do anything, so don't worry + * about it + */ + SFG_Window *win = window; + switch (window->State.DesiredVisibility) { - /* Visibility status of window should get updated in the window message handlers - * For now, none of these functions called below do anything, so don't worry - * about it - */ - SFG_Window *win = window; - switch (window->State.DesiredVisibility) - { - case DesireHiddenState: - fgPlatformHideWindow( window ); - break; - case DesireIconicState: - /* Call on top-level window */ - while (win->Parent) - win = win->Parent; - fgPlatformIconifyWindow( win ); - break; - case DesireNormalState: - fgPlatformShowWindow( window ); - break; - } + case DesireHiddenState: + fgPlatformHideWindow( window ); + break; + case DesireIconicState: + /* Call on top-level window */ + while (win->Parent) + win = win->Parent; + fgPlatformIconifyWindow( win ); + break; + case DesireNormalState: + fgPlatformShowWindow( window ); + break; } }