X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_main.c;h=1e313c46e569854c494b407f538ca41d7ab23143;hb=98ea79ef777bea593a87aef9600ee3d4fda6e110;hp=85bab79d8ae6b4ffaccd542b2a109b95ea90fe26;hpb=99532b98a9b24cbf41fdf83789f74fef2dbc8b6c;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 85bab79..1e313c4 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -65,8 +65,9 @@ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ /* - * Calls a window's redraw method. This is used when - * a redraw is forced by the incoming window messages. + * Handle a window configuration change. When no reshape + * callback is hooked, the viewport size is updated to + * match the new window size. * * XXX We can/should make a "unified" window handle type so that * XXX the function headers don't need this silly #ifdef junk. @@ -74,55 +75,80 @@ * XXX {Window}. On WIN32, it is {HWND}. Then do the #ifdef * XXX junk *once* in "freeglut_internal.h". */ -static void fghRedrawWindowByHandle +static void fghReshapeWindowByHandle #if TARGET_HOST_UNIX_X11 - ( Window handle ) + ( Window handle, int width, int height ) #elif TARGET_HOST_WIN32 - ( HWND handle ) + ( HWND handle, int width, int height ) #endif { + SFG_Window *current_window = fgStructure.Window; + SFG_Window* window = fgWindowByHandle( handle ); freeglut_return_if_fail( window != NULL ); + +#if TARGET_HOST_UNIX_X11 + + XResizeWindow( fgDisplay.Display, window->Window.Handle, + width, height ); + XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ /* - * XXX Other than clearing the Redisplay flag or not, - * XXX we may as well rely on the INVOK_WCB() doing this - * XXX pointer-check. - * XXX - * XXX If we do not invoke the display because the pointer - * XXX is not defined (should never happen, really), then - * XXX we may enter an infinite busy-loop trying to update - * XXX the window. Similarly, if we skip because the window - * XXX is not visible. However, if the window becomes visible - * XXX at a later time, the window should get its callback - * XXX invoked. I would recommend removing the first check, - * XXX and making the second check only affect whether the - * XXX callback is invoked---but always clear the flag, if - * XXX the {window} pointer is defined. + * XXX REALLY shouldn't be done. GLUT docs state that this + * XXX isn't even processed immediately, but rather waits + * XXX for return to the mainloop. "This allows multiple + * XXX glutReshapeWindow, glutPositionWindow, and glutFullScreen + * XXX requests to the same window to be coalesced." (This is + * XXX having some deleterious effect on a sample program of mine.) + * XXX Not only does GLUT not flush at this point, GLUT doesn't even + * XXX *do* the reshape at this point! We should probably rip this + * XXX out and do what GLUT promises. It would be more efficient, and + * XXX might be more compatible. */ - freeglut_return_if_fail( FETCH_WCB( *window, Display ) ); - freeglut_return_if_fail( window->State.Visible ); - window->State.Redisplay = GL_FALSE; - INVOKE_WCB( *window, Display, ( ) ); -} - -/* - * Handle a window configuration change. When no reshape - * callback is hooked, the viewport size is updated to - * match the new window size. - */ -static void fghReshapeWindowByHandle -#if TARGET_HOST_UNIX_X11 - ( Window handle, int width, int height ) #elif TARGET_HOST_WIN32 - ( HWND handle, int width, int height ) -#endif -{ - SFG_Window *current_window = fgStructure.Window; - SFG_Window* window = fgWindowByHandle( handle ); - freeglut_return_if_fail( window != NULL ); + { + RECT winRect; + int x, y; + + GetWindowRect( window->Window.Handle, &winRect ); + x = winRect.left; + y = winRect.top; + + if ( window->Parent == NULL ) + { + /* + * Adjust the size of the window to allow for the size of the + * frame, if we are not a menu + */ + if ( ! window->IsMenu ) + { + width += GetSystemMetrics( SM_CXSIZEFRAME ) * 2; + height += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 + + GetSystemMetrics( SM_CYCAPTION ); + } + } + else + { + GetWindowRect( window->Parent->Window.Handle, + &winRect ); + x -= winRect.left + GetSystemMetrics( SM_CXSIZEFRAME ); + y -= winRect.top + GetSystemMetrics( SM_CYSIZEFRAME ) + + GetSystemMetrics( SM_CYCAPTION ); + } + + MoveWindow( + window->Window.Handle, + x, + y, + width, + height, + TRUE + ); + } + +#endif if( !( FETCH_WCB( *window, Reshape ) ) ) { @@ -146,32 +172,37 @@ static void fghReshapeWindowByHandle } /* - * A static helper function to execute display callback for a window + * Calls a window's redraw method. This is used when + * a redraw is forced by the incoming window messages. */ -static void fghcbDisplayWindow( SFG_Window *window, SFG_Enumerator *enumerator ) -{ +static void fghRedrawWindowByHandle #if TARGET_HOST_UNIX_X11 + ( Window handle ) +#elif TARGET_HOST_WIN32 + ( HWND handle ) +#endif +{ + SFG_Window* window = fgWindowByHandle( handle ); + freeglut_return_if_fail( window != NULL ); + /* - * XXX Do we need/want to check the callback pointer here? - * XXX INVOKE_WCB() will check for us. Arguably, the - * XXX Redisplay status flag should be cleared regardless - * XXX of any concern but that {window} is a valid pointer - * XXX (which this function is assuming anyway). - * XXX Especially since old GLUT wouldn't even enter its main - * XXX loop if you didn't have a display callback defined... + * XXX Other than clearing the Redisplay flag or not, + * XXX we may as well rely on the INVOK_WCB() doing this + * XXX pointer-check. + * XXX + * XXX If we do not invoke the display because the pointer + * XXX is not defined (should never happen, really), then + * XXX we may enter an infinite busy-loop trying to update + * XXX the window. Similarly, if we skip because the window + * XXX is not visible. However, if the window becomes visible + * XXX at a later time, the window should get its callback + * XXX invoked. I would recommend removing the first check, + * XXX and making the second check only affect whether the + * XXX callback is invoked---but always clear the flag, if + * XXX the {window} pointer is defined. */ - if( ( FETCH_WCB( *window, Display ) ) && - window->State.Redisplay && - window->State.Visible ) - { - SFG_Window *current_window = fgStructure.Window; - - window->State.Redisplay = GL_FALSE; - INVOKE_WCB( *window, Display, ( ) ); - fgSetWindow( current_window ); - } - -#elif TARGET_HOST_WIN32 + freeglut_return_if_fail( FETCH_WCB( *window, Display ) ); + freeglut_return_if_fail( window->State.Visible ); if( window->State.NeedToResize ) { @@ -181,30 +212,69 @@ static void fghcbDisplayWindow( SFG_Window *window, SFG_Enumerator *enumerator ) fghReshapeWindowByHandle( window->Window.Handle, - glutGet( GLUT_WINDOW_WIDTH ), - glutGet( GLUT_WINDOW_HEIGHT ) + window->State.Width, + window->State.Height ); window->State.NeedToResize = GL_FALSE; fgSetWindow ( current_window ); } + window->State.Redisplay = GL_FALSE; + INVOKE_WCB( *window, Display, ( ) ); +} + +/* + * A static helper function to execute display callback for a window + */ +static void fghcbDisplayWindow( SFG_Window *window, + SFG_Enumerator *enumerator ) +{ /* - * XXX See above comment about the Redisplay flag... + * XXX Do we need/want to check the callback pointer here? + * XXX INVOKE_WCB() will check for us. Arguably, the + * XXX Redisplay status flag should be cleared regardless + * XXX of any concern but that {window} is a valid pointer + * XXX (which this function is assuming anyway). + * XXX Especially since old GLUT wouldn't even enter its main + * XXX loop if you didn't have a display callback defined... */ if( ( FETCH_WCB( *window, Display ) ) && window->State.Redisplay && window->State.Visible ) { + if( window->State.NeedToResize ) + { + SFG_Window *current_window = fgStructure.Window; + + fgSetWindow( window ); + + fghReshapeWindowByHandle( + window->Window.Handle, + window->State.Width, + window->State.Height + ); + + window->State.NeedToResize = GL_FALSE; + fgSetWindow ( current_window ); + } + window->State.Redisplay = GL_FALSE; +#if TARGET_HOST_UNIX_X11 + { + SFG_Window *current_window = fgStructure.Window; + + INVOKE_WCB( *window, Display, ( ) ); + fgSetWindow( current_window ); + } +#elif TARGET_HOST_WIN32 RedrawWindow( window->Window.Handle, NULL, NULL, RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW ); - } - #endif + } fgEnumSubWindows( window, fghcbDisplayWindow, enumerator ); } @@ -217,7 +287,7 @@ static void fghDisplayAll( void ) SFG_Enumerator enumerator; enumerator.found = GL_FALSE; - enumerator.data = NULL; + enumerator.data = NULL; fgEnumWindows( fghcbDisplayWindow, &enumerator ); } @@ -248,7 +318,7 @@ static void fghCheckJoystickPolls( void ) SFG_Enumerator enumerator; enumerator.found = GL_FALSE; - enumerator.data = NULL; + enumerator.data = NULL; fgEnumWindows( fghcbCheckJoystickPolls, &enumerator ); } @@ -296,20 +366,20 @@ static void fghCheckTimers( void ) */ long fgElapsedTime( void ) { - if (fgState.Time.Set) + if ( fgState.Time.Set ) { #if TARGET_HOST_UNIX_X11 struct timeval now; long elapsed; - + gettimeofday( &now, NULL ); - - elapsed = ( now.tv_usec - fgState.Time.Value.tv_usec ) / 1000; - elapsed += ( now.tv_sec - fgState.Time.Value.tv_sec ) * 1000; - + + elapsed = (now.tv_usec - fgState.Time.Value.tv_usec) / 1000; + elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000; + return elapsed; #elif TARGET_HOST_WIN32 - return timeGetTime( ) - fgState.Time.Value; + return timeGetTime() - fgState.Time.Value; #endif } else @@ -317,9 +387,11 @@ long fgElapsedTime( void ) #if TARGET_HOST_UNIX_X11 gettimeofday( &fgState.Time.Value, NULL ); #elif TARGET_HOST_WIN32 - fgState.Time.Value = timeGetTime( ); + fgState.Time.Value = timeGetTime (); #endif - fgState.Time.Set = GL_TRUE; + fgState.Time.Set = GL_TRUE ; + + return 0 ; } } @@ -332,16 +404,16 @@ void fgError( const char *fmt, ... ) va_start( ap, fmt ); - fprintf( stderr, "freeglut " ); + fprintf( stderr, "freeglut "); if( fgState.ProgramName ) - fprintf( stderr, "(%s): ", fgState.ProgramName ); + fprintf (stderr, "(%s): ", fgState.ProgramName); vfprintf( stderr, fmt, ap ); fprintf( stderr, "\n" ); va_end( ap ); if ( fgState.Initialised ) - fgDeinitialize( ); + fgDeinitialize (); exit( 1 ); } @@ -352,7 +424,7 @@ void fgWarning( const char *fmt, ... ) va_start( ap, fmt ); - fprintf( stderr, "freeglut " ); + fprintf( stderr, "freeglut "); if( fgState.ProgramName ) fprintf( stderr, "(%s): ", fgState.ProgramName ); vfprintf( stderr, fmt, ap ); @@ -381,7 +453,7 @@ void fgWarning( const char *fmt, ... ) * an opaque wall. * */ -static void fgCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e ) +static void fgCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e) { if( FETCH_WCB( *w, Joystick ) ) { @@ -398,7 +470,7 @@ static int fgHaveJoystick( void ) fgEnumWindows( fgCheckJoystickCallback, &enumerator ); return !!enumerator.data; } -static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e ) +static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e) { if( w->State.Redisplay ) { @@ -407,7 +479,7 @@ static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e ) } fgEnumSubWindows( w, fgHavePendingRedisplaysCallback, e ); } -static int fgHavePendingRedisplays( void ) +static int fgHavePendingRedisplays (void) { SFG_Enumerator enumerator; enumerator.found = GL_FALSE; @@ -418,22 +490,24 @@ static int fgHavePendingRedisplays( void ) /* * Indicates whether there are any outstanding timers. */ +#if 0 /* Not used */ static int fgHaveTimers( void ) { return !!fgState.Timers.First; } +#endif /* * Returns the number of GLUT ticks (milliseconds) till the next timer event. */ static long fgNextTimer( void ) { - long now = fgElapsedTime( ); + long now = fgElapsedTime(); long ret = INT_MAX; SFG_Timer *timer; - for( timer = ( SFG_Timer * )fgState.Timers.First; + for( timer = (SFG_Timer *)fgState.Timers.First; timer; - timer = ( SFG_Timer * )timer->Node.Next ) + timer = (SFG_Timer *)timer->Node.Next ) ret = MIN( ret, MAX( 0, timer->TriggerTime - now ) ); return ret; @@ -461,12 +535,12 @@ static void fgSleepForEvents( void ) if( fgHaveJoystick( ) ) msec = MIN( msec, 10 ); - wait.tv_sec = msec / 1000; - wait.tv_usec = ( msec % 1000 ) * 1000; + wait.tv_sec = msec / 1000; + wait.tv_usec = (msec % 1000) * 1000; err = select( socket+1, &fdset, NULL, NULL, &wait ); if( -1 == err ) - fgWarning( "freeglut select() error: %d\n", errno ); + fgWarning ( "freeglut select() error: %d\n", errno ); #elif TARGET_HOST_WIN32 #endif @@ -551,11 +625,10 @@ void FGAPIENTRY glutMainLoopEvent( void ) */ case CreateNotify: case ConfigureNotify: - fghReshapeWindowByHandle( - event.xconfigure.window, - event.xconfigure.width, - event.xconfigure.height - ); + GETWINDOW( xconfigure ); + window->State.NeedToResize = GL_TRUE ; + window->State.Width = event.xconfigure.width ; + window->State.Height = event.xconfigure.height; break; case DestroyNotify: @@ -656,7 +729,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) window->ActiveMenu->Window->State.MouseY = event.xmotion.y_root - window->ActiveMenu->Y; } - window->ActiveMenu->Window->State.Redisplay = GL_TRUE; + window->ActiveMenu->Window->State.Redisplay = GL_TRUE ; fgSetWindow( window->ActiveMenu->ParentWindow ); break; @@ -668,7 +741,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) */ #define BUTTON_MASK \ ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) - if( event.xmotion.state & BUTTON_MASK ) + if ( event.xmotion.state & BUTTON_MASK ) INVOKE_WCB( *window, Motion, ( event.xmotion.x, event.xmotion.y ) ); else @@ -684,7 +757,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) int button; if( event.type == ButtonRelease ) - pressed = GL_FALSE; + pressed = GL_FALSE ; /* * A mouse button has been pressed or released. Traditionally, @@ -823,7 +896,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) * XXX Note that {button} has already been decremeted * XXX in mapping from X button numbering to GLUT. */ - int wheel_number = ( button - 3 ) / 2; + int wheel_number = (button - 3) / 2; int direction = -1; if( button % 2 ) direction = 1; @@ -942,7 +1015,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) * Execute the callback (if one has been specified), * given that the special code seems to be valid... */ - if( special_cb && ( special != -1 ) ) + if( special_cb && (special != -1) ) { fgSetWindow( window ); fgState.Modifiers = fgGetXModifiers( &event ); @@ -958,7 +1031,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) break; /* XXX Should disable this event */ default: - fgWarning( "Unknown X event type: %d", event.type ); + fgWarning ("Unknown X event type: %d", event.type); break; } } @@ -970,7 +1043,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) while( PeekMessage( &stMsg, NULL, 0, 0, PM_NOREMOVE ) ) { if( GetMessage( &stMsg, NULL, 0, 0 ) == 0 ) - fgState.ExecState = GLUT_EXEC_STATE_STOP; + fgState.ExecState = GLUT_EXEC_STATE_STOP ; TranslateMessage( &stMsg ); DispatchMessage( &stMsg ); @@ -991,7 +1064,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) void FGAPIENTRY glutMainLoop( void ) { #if TARGET_HOST_WIN32 - SFG_Window *window = (SFG_Window *)fgStructure.Windows.First; + SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; #endif freeglut_assert_ready; @@ -1008,19 +1081,19 @@ void FGAPIENTRY glutMainLoop( void ) */ while( window ) { - if( FETCH_WCB( *window, Visibility ) ) + if ( FETCH_WCB( *window, Visibility ) ) { - SFG_Window *current_window = fgStructure.Window; + SFG_Window *current_window = fgStructure.Window ; INVOKE_WCB( *window, Visibility, ( window->State.Visible ) ); fgSetWindow( current_window ); } - window = (SFG_Window *)window->Node.Next; + window = (SFG_Window *)window->Node.Next ; } #endif - fgState.ExecState = GLUT_EXEC_STATE_RUNNING; + fgState.ExecState = GLUT_EXEC_STATE_RUNNING ; while( fgState.ExecState == GLUT_EXEC_STATE_RUNNING ) { glutMainLoopEvent( ); @@ -1032,7 +1105,7 @@ void FGAPIENTRY glutMainLoop( void ) if( fgState.IdleCallback ) fgState.IdleCallback( ); - fgSleepForEvents( ); + fgSleepForEvents(); } } @@ -1055,7 +1128,7 @@ void FGAPIENTRY glutMainLoop( void ) */ void FGAPIENTRY glutLeaveMainLoop( void ) { - fgState.ExecState = GLUT_EXEC_STATE_STOP; + fgState.ExecState = GLUT_EXEC_STATE_STOP ; } @@ -1119,7 +1192,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, wglCreateContext( window->Window.Device ); } - /* window->Window.Context = wglGetCurrentContext( ); */ + /* window->Window.Context = wglGetCurrentContext (); */ window->Window.Context = wglCreateContext( window->Window.Device ); } else @@ -1139,6 +1212,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, } window->State.NeedToResize = GL_TRUE; + window->State.Width = fgState.Size.X; + window->State.Height = fgState.Size.Y; + ReleaseDC( window->Window.Handle, window->Window.Device ); break; @@ -1146,16 +1222,18 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, /* * We got resized... But check if the window has been already added... */ - fghReshapeWindowByHandle( hWnd, LOWORD(lParam), HIWORD(lParam) ); + window->State.NeedToResize = GL_TRUE; + window->State.Width = LOWORD(lParam); + window->State.Height = HIWORD(lParam); break; #if 0 case WM_SETFOCUS: - printf( "WM_SETFOCUS: %p\n", window ); + printf("WM_SETFOCUS: %p\n", window ); lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); break; case WM_ACTIVATE: - if( LOWORD( wParam ) != WA_INACTIVE ) + if (LOWORD(wParam) != WA_INACTIVE) { /* glutSetCursor( fgStructure.Window->State.Cursor ); */ printf("WM_ACTIVATE: glutSetCursor( %p, %d)\n", window, @@ -1167,34 +1245,26 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, break; #endif - case WM_SETCURSOR: - /* - * Windows seems to need reminding to erase the cursor for NONE. - */ - /* - * XXX Is this #if 0 section anything that we need to worry - * XXX about? Can we delete it? If it will ever be used, - * XXX why not re-use some common code with the glutSetCursor() + * XXX Why not re-use some common code with the glutSetCursor() * XXX function (or perhaps invoke glutSetCursor())? + * XXX That is, why are we duplicating code, here, from + * XXX glutSetCursor()? The WIN32 code should be able to just + * XXX call glutSetCurdsor() instead of defining two macros + * XXX and implementing a nested case in-line. */ -#if 0 - if( ( LOWORD( lParam ) == HTCLIENT ) && - ( fgStructure.Window->State.Cursor == GLUT_CURSOR_NONE ) ) - SetCursor( NULL ); -#else - + case WM_SETCURSOR: /* Set the cursor AND change it for this window class. */ -#define MAP_CURSOR(a,b) \ - case a: \ - SetCursor( LoadCursor( NULL, b ) ); \ - break; +#define MAP_CURSOR(a,b) \ + case a: \ + SetCursor( LoadCursor( NULL, b ) ); \ + break; /* Nuke the cursor AND change it for this window class. */ -#define ZAP_CURSOR(a,b) \ - case a: \ - SetCursor( NULL ); \ - break; +#define ZAP_CURSOR(a,b) \ + case a: \ + SetCursor( NULL ); \ + break; if( LOWORD( lParam ) == HTCLIENT ) switch( window->State.Cursor ) @@ -1215,7 +1285,6 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, default: MAP_CURSOR( GLUT_CURSOR_UP_DOWN, IDC_ARROW ); } -#endif else lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); break; @@ -1239,8 +1308,8 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, */ if( fgStructure.Window == window ) { - int used = FALSE; - SFG_Window *iter; + int used = FALSE ; + SFG_Window *iter ; wglMakeCurrent( NULL, NULL ); /* @@ -1256,7 +1325,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, used = TRUE; } - if( used == FALSE ) + if( ! used ) wglDeleteContext( window->Window.Context ); } @@ -1314,31 +1383,36 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, window->State.MouseX = LOWORD( lParam ); window->State.MouseY = HIWORD( lParam ); - /* - * XXX Either these multi-statement lines should be broken - * XXX in the form: - * XXX pressed = GL_TRUE; - * XXX button = GLUT_LEFT_BUTTON; - * XXX break; - * XXX ...or we should use a macro (much as I dislike freeglut's - * XXX preponderance of using macros to "compress" code). - */ switch( uMsg ) { case WM_LBUTTONDOWN: - pressed = GL_TRUE; button = GLUT_LEFT_BUTTON; break; + pressed = GL_TRUE; + button = GLUT_LEFT_BUTTON; + break; case WM_MBUTTONDOWN: - pressed = GL_TRUE; button = GLUT_MIDDLE_BUTTON; break; + pressed = GL_TRUE; + button = GLUT_MIDDLE_BUTTON; + break; case WM_RBUTTONDOWN: - pressed = GL_TRUE; button = GLUT_RIGHT_BUTTON; break; + pressed = GL_TRUE; + button = GLUT_RIGHT_BUTTON; + break; case WM_LBUTTONUP: - pressed = GL_FALSE; button = GLUT_LEFT_BUTTON; break; + pressed = GL_FALSE; + button = GLUT_LEFT_BUTTON; + break; case WM_MBUTTONUP: - pressed = GL_FALSE; button = GLUT_MIDDLE_BUTTON; break; + pressed = GL_FALSE; + button = GLUT_MIDDLE_BUTTON; + break; case WM_RBUTTONUP: - pressed = GL_FALSE; button = GLUT_RIGHT_BUTTON; break; + pressed = GL_FALSE; + button = GLUT_RIGHT_BUTTON; + break; default: - pressed = GL_FALSE; button = -1; break; + pressed = GL_FALSE; + button = -1; + break; } if( GetSystemMetrics( SM_SWAPBUTTON ) ) @@ -1500,13 +1574,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, fgState.Modifiers = 0xffffffff; } - break; + break ; case WM_SYSKEYDOWN: case WM_KEYDOWN: { int keypress = -1; - POINT mouse_pos; + POINT mouse_pos ; if( fgState.IgnoreKeyRepeat && (lParam & KF_REPEAT) ) break; @@ -1682,7 +1756,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, /* User has finished resizing the window, force a redraw */ INVOKE_WCB( *window, Display, ( ) ); - /*lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ) ; */ + /*lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); */ break; /* @@ -1734,57 +1808,58 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, */ switch ( lParam ) { - case SC_SIZE: - break; + case SC_SIZE : + break ; - case SC_MOVE: - break; + case SC_MOVE : + break ; - case SC_MINIMIZE: + case SC_MINIMIZE : /* User has clicked on the "-" to minimize the window */ /* Turn off the visibility */ - window->State.Visible = GL_FALSE; - break; + window->State.Visible = GL_FALSE ; - case SC_MAXIMIZE: - break; + break ; - case SC_NEXTWINDOW: - break; + case SC_MAXIMIZE : + break ; - case SC_PREVWINDOW: - break; + case SC_NEXTWINDOW : + break ; + + case SC_PREVWINDOW : + break ; - case SC_CLOSE: + case SC_CLOSE : /* Followed very closely by a WM_CLOSE message */ - break; + break ; - case SC_VSCROLL: - break; + case SC_VSCROLL : + break ; - case SC_HSCROLL: - break; + case SC_HSCROLL : + break ; - case SC_MOUSEMENU: - break; + case SC_MOUSEMENU : + break ; - case SC_KEYMENU: - break; + case SC_KEYMENU : + break ; - case SC_ARRANGE: - break; + case SC_ARRANGE : + break ; - case SC_RESTORE: - break; + case SC_RESTORE : + break ; - case SC_TASKLIST: - break; + case SC_TASKLIST : + break ; - case SC_SCREENSAVE: - break; + case SC_SCREENSAVE : + break ; - case SC_HOTKEY: - break; + case SC_HOTKEY : + break ; } }