X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_main_x11.c;h=0e542535b756c8de6591b43f763ef5d6a2e8fe81;hb=2c12c9eb8d63cabac2d4113b4f54fdf53da8368c;hp=897b7ee243f4e9bcd084397e3edacff7144d1f35;hpb=a00c7ee3552b527ac6b375d6a6ca42f90770ddc3;p=freeglut diff --git a/src/x11/fg_main_x11.c b/src/x11/fg_main_x11.c index 897b7ee..0e54253 100644 --- a/src/x11/fg_main_x11.c +++ b/src/x11/fg_main_x11.c @@ -1,5 +1,5 @@ /* - * freeglut_main_x11.c + * fg_main_x11.c * * The X11-specific windows message processing methods. * @@ -28,17 +28,8 @@ #include #include "../fg_internal.h" -#ifdef HAVE_ERRNO_H -# include -#endif +#include #include -#ifdef HAVE_VFPRINTF -# define VFPRINTF(s,f,a) vfprintf((s),(f),(a)) -#elif defined(HAVE__DOPRNT) -# define VFPRINTF(s,f,a) _doprnt((f),(a),(s)) -#else -# define VFPRINTF(s,f,a) -#endif /* @@ -125,10 +116,8 @@ void fgPlatformSleepForEvents( fg_time_t msec ) wait.tv_usec = (msec % 1000) * 1000; err = select( socket+1, &fdset, NULL, NULL, &wait ); -#ifdef HAVE_ERRNO_H if( ( -1 == err ) && ( errno != EINTR ) ) fgWarning ( "freeglut select() error: %d", errno ); -#endif } } @@ -1078,38 +1067,19 @@ 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; - - if (workMask&~GLUT_DISPLAY_WORK) /* Display work is the common case, skip all the below at once */ - { - /* 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. + /* Notify windowStatus/visibility, position and size get notified on window creation with message handlers above + * XXX CHECK: do the 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? + * -> this is a no-op */ - if (workMask & GLUT_INIT_WORK) - { - /* Notify windowStatus/visibility, position and size get notified on window creation with message handlers above - * XXX CHECK: do the 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 ); - } + return; +} +void fgPlatformPosResZordWork(SFG_Window* window, unsigned int workMask) +{ if (workMask & GLUT_FULL_SCREEN_WORK) fgPlatformFullScreenToggle( window ); if (workMask & GLUT_POSITION_WORK) @@ -1123,38 +1093,28 @@ void fgPlatformProcessWork(SFG_Window *window) else fgPlatformPopWindow( window ); } +} - if (workMask & GLUT_VISIBILITY_WORK) - { - /* Visibility status of window gets updated in the window message handlers above - * XXX: is this really the case? check - */ - 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; - } - } - } - - if (workMask & GLUT_DISPLAY_WORK) +void fgPlatformVisibilityWork(SFG_Window* window) +{ + /* Visibility status of window gets updated in the window message handlers above + * XXX: is this really the case? check + */ + SFG_Window *win = window; + switch (window->State.DesiredVisibility) { - if( window->State.Visible ) - fghRedrawWindow ( window ); - - /* Strip out display work that might have ended up on work list now as some of the above genereates callbacks */ - window->State.WorkMask &= ~GLUT_DISPLAY_WORK; + 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; } }