4 * The windows message processing methods.
6 * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
7 * Written by Pawel W. Olszta, <olszta@sourceforge.net>
8 * Creation date: Fri Dec 3 1999
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 #define G_LOG_DOMAIN "freeglut-main"
34 #include "../include/GL/freeglut.h"
35 #include "freeglut_internal.h"
38 * TODO BEFORE THE STABLE RELEASE:
40 * There are some issues concerning window redrawing under X11, and maybe
41 * some events are not handled. The Win32 version lacks some more features,
42 * but seems acceptable for not demanding purposes.
44 * Need to investigate why the X11 version breaks out with an error when
45 * closing a window (using the window manager, not glutDestroyWindow)...
48 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
51 * Calls a window's redraw method. This is used when
52 * a redraw is forced by the incoming window messages.
55 static void fghRedrawWindowByHandle
56 #if TARGET_HOST_UNIX_X11
58 #elif TARGET_HOST_WIN32
63 * Find the window we have to redraw...
65 SFG_Window* window = fgWindowByHandle( handle );
66 freeglut_return_if_fail( window != NULL );
69 * Check if there is a display callback hooked to it
71 freeglut_return_if_fail( window->Callbacks.Display != NULL );
74 * Return if the window is not visible
76 freeglut_return_if_fail( window->State.Visible == TRUE );
79 * Set the window as the current one.
81 fgSetWindow( window );
84 * Do not exagerate with the redisplaying
86 window->State.Redisplay = FALSE;
89 * Have the callback executed now. The buffers should
90 * be swapped by the glutSwapBuffers() execution inside
91 * the callback itself.
94 window->Callbacks.Display();
98 * Handle a window configuration change. When no reshape
99 * callback is hooked, the viewport size is updated to
100 * match the new window size.
102 static void fghReshapeWindowByHandle
103 #if TARGET_HOST_UNIX_X11
104 ( Window handle, int width, int height )
105 #elif TARGET_HOST_WIN32
106 ( HWND handle, int width, int height )
109 SFG_Window *current_window = fgStructure.Window ;
112 * Find the window that received the reshape event
114 SFG_Window* window = fgWindowByHandle( handle );
115 freeglut_return_if_fail( window != NULL );
118 * Remember about setting the current window...
120 fgSetWindow( window );
123 * Check if there is a reshape callback hooked
125 if( window->Callbacks.Reshape != NULL )
128 * OKi, have it called immediately
130 window->Callbacks.Reshape( width, height );
135 * Otherwise just resize the viewport
137 glViewport( 0, 0, width, height );
141 * Force a window redraw. In Windows at least this is only a partial solution: if the
142 * window is increasing in size in either dimension, the already-drawn part does not get
143 * drawn again and things look funny. But without this we get this bad behaviour whenever
144 * we resize the window.
146 window->State.Redisplay = TRUE ;
149 * If this is a menu, restore the active window
151 if ( window->IsMenu )
152 fgSetWindow ( current_window ) ;
156 * A static helper function to execute display callback for a window
158 static void fghcbDisplayWindow( SFG_Window *window, SFG_Enumerator *enumerator )
160 #if TARGET_HOST_UNIX_X11
162 * Check if there is an idle callback hooked
164 if( (window->Callbacks.Display != NULL) &&
165 (window->State.Redisplay == TRUE) &&
166 (window->State.Visible == TRUE) )
168 SFG_Window *current_window = fgStructure.Window ;
171 * OKi, this is the case: have the window set as the current one
173 fgSetWindow( window );
176 * Do not exagerate with the redisplaying
178 window->State.Redisplay = FALSE;
181 * And execute the display callback immediately after
183 window->Callbacks.Display();
185 fgSetWindow ( current_window ) ;
188 #elif TARGET_HOST_WIN32
191 * Do we need to explicitly resize the window?
193 if( window->State.NeedToResize )
195 SFG_Window *current_window = fgStructure.Window ;
197 fgSetWindow( window );
199 fghReshapeWindowByHandle(
200 window->Window.Handle,
201 glutGet( GLUT_WINDOW_WIDTH ),
202 glutGet( GLUT_WINDOW_HEIGHT )
206 * Never ever do that again:
208 window->State.NeedToResize = FALSE;
210 fgSetWindow ( current_window ) ;
214 * This is done in a bit different way under Windows
216 if( (window->Callbacks.Display != NULL) &&
217 (window->State.Redisplay == TRUE) &&
218 (window->State.Visible == TRUE) )
221 * Do not exagerate with the redisplaying
223 window->State.Redisplay = FALSE;
226 window->Window.Handle, NULL, NULL,
227 RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW
234 * Process this window's children (if any)
236 fgEnumSubWindows( window, fghcbDisplayWindow, enumerator );
240 * Make all windows perform a display call
242 static void fghDisplayAll( void )
244 SFG_Enumerator enumerator;
247 * Uses a method very similiar for fgWindowByHandle...
249 enumerator.found = FALSE;
250 enumerator.data = NULL;
253 * Start the enumeration now:
255 fgEnumWindows( fghcbDisplayWindow, &enumerator );
259 * Window enumerator callback to check for the joystick polling code
261 static void fghcbCheckJoystickPolls( SFG_Window *window, SFG_Enumerator *enumerator )
263 long int checkTime = fgElapsedTime();
266 * Check if actually need to do the poll for the currently enumerated window:
268 if( window->State.JoystickLastPoll + window->State.JoystickPollRate <= checkTime )
271 * Yeah, that's it. Poll the joystick...
273 fgJoystickPollWindow( window );
276 * ...and reset the polling counters:
278 window->State.JoystickLastPoll = checkTime;
282 * Process this window's children (if any)
284 fgEnumSubWindows( window, fghcbCheckJoystickPolls, enumerator );
288 * Check all windows for joystick polling
290 static void fghCheckJoystickPolls( void )
292 SFG_Enumerator enumerator;
295 * Uses a method very similiar for fgWindowByHandle...
297 enumerator.found = FALSE;
298 enumerator.data = NULL;
301 * Start the enumeration now:
303 fgEnumWindows( fghcbCheckJoystickPolls, &enumerator );
307 * Check the global timers
309 static void fghCheckTimers( void )
311 long checkTime = fgElapsedTime();
312 SFG_Timer *timer, *next;
315 fgListInit(&timedOut);
318 * For every timer that is waiting for triggering
320 for( timer = (SFG_Timer *)fgState.Timers.First; timer; timer = (SFG_Timer *)next )
322 next = (SFG_Timer *)timer->Node.Next;
325 * Check for the timeout:
327 if( timer->TriggerTime <= checkTime )
330 * Add the timer to the timed out timers list
332 fgListRemove( &fgState.Timers, &timer->Node );
333 fgListAppend( &timedOut, &timer->Node );
338 * Now feel free to execute all the hooked and timed out timer callbacks
339 * And delete the timed out timers...
341 while ( (timer = (SFG_Timer *)timedOut.First) )
343 if( timer->Callback != NULL )
344 timer->Callback( timer->ID );
345 fgListRemove( &timedOut, &timer->Node );
354 long fgElapsedTime( void )
356 #if TARGET_HOST_UNIX_X11
360 gettimeofday( &now, NULL );
362 elapsed = (now.tv_usec - fgState.Time.Value.tv_usec) / 1000;
363 elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000;
366 #elif TARGET_HOST_WIN32
367 return (timeGetTime() - fgState.Time.Value);
374 void fgError( const char *fmt, ... )
380 fprintf( stderr, "freeglut: ");
381 vfprintf( stderr, fmt, ap );
382 fprintf( stderr, "\n" );
389 void fgWarning( const char *fmt, ... )
395 fprintf( stderr, "freeglut: ");
396 vfprintf( stderr, fmt, ap );
397 fprintf( stderr, "\n" );
402 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
405 * Executes a single iteration in the freeglut processing loop.
407 void FGAPIENTRY glutMainLoopEvent( void )
409 #if TARGET_HOST_UNIX_X11
415 * This code was repeated constantly, so here it goes into a definition:
417 # define GETWINDOW(a) window = fgWindowByHandle( event.a.window );if( window == NULL ) break;
418 # define GETMOUSE(a) window->State.MouseX = event.a.x; window->State.MouseY = event.a.y;
421 * Make sure the display has been created etc.
423 freeglut_assert_ready;
426 * Do we have any event messages pending?
428 if( XPending( fgDisplay.Display ) )
431 * Grab the next event to be processed...
433 XNextEvent( fgDisplay.Display, &event );
436 * Check the event's type
442 * The window creation confirmation
448 * This is sent to confirm the XDestroyWindow call.
451 * Call the window closure callback, remove from the structure, etc.
453 /* fgAddToWindowDestroyList ( window, FALSE ); */
459 * Destroy the window when the WM_DELETE_WINDOW message arrives
461 if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.DeleteWindow )
463 GETWINDOW( xclient );
466 * Call the XWindows functions to close the window
468 fgCloseWindow ( window ) ;
471 * Call the window closure callback, remove from the structure, etc.
473 fgAddToWindowDestroyList ( window, FALSE );
479 * A window of ours has been unmapped...
485 * We are too dumb to process partial exposes...
487 if( event.xexpose.count == 0 )
488 fghRedrawWindowByHandle( event.xexpose.window );
491 case ConfigureNotify:
493 * The window gets resized
495 fghReshapeWindowByHandle(
496 event.xconfigure.window,
497 event.xconfigure.width,
498 event.xconfigure.height
504 * Have the client's keyboard knowledge updated (xlib.ps,
505 * page 206, says that's a good thing to do)
507 XRefreshKeyboardMapping( (XMappingEvent *) &event );
510 case VisibilityNotify:
513 * The window's visiblity might have changed
515 GETWINDOW( xvisibility );
518 * Break now if no window status callback has been hooked to that window
520 if( window->Callbacks.WindowStatus == NULL )
524 * We're going to send a callback to a window. Make it current.
526 fgSetWindow( window );
529 * Sending this event, the X server can notify us that the window has just
530 * acquired one of the three possible visibility states: VisibilityUnobscured,
531 * VisibilityPartiallyObscured or VisibilityFullyObscured
533 switch( event.xvisibility.state )
535 case VisibilityUnobscured:
537 * We are fully visible...
539 window->Callbacks.WindowStatus( GLUT_FULLY_RETAINED );
540 window->State.Visible = TRUE;
543 case VisibilityPartiallyObscured:
545 * The window is partially visible
547 window->Callbacks.WindowStatus( GLUT_PARTIALLY_RETAINED );
548 window->State.Visible = TRUE;
551 case VisibilityFullyObscured:
553 * The window is totally obscured
555 window->Callbacks.WindowStatus( GLUT_FULLY_COVERED );
556 window->State.Visible = FALSE;
565 * Mouse is over one of our windows
567 GETWINDOW( xcrossing ); GETMOUSE( xcrossing );
570 * Is there an entry callback hooked to the window?
572 if( window->Callbacks.Entry != NULL )
575 * Set the current window
577 fgSetWindow ( window ) ;
580 * Yeah. Notify the window about having the mouse cursor over
582 window->Callbacks.Entry( GLUT_ENTERED );
590 * Mouse is no longer over one of our windows
592 GETWINDOW( xcrossing ); GETMOUSE( xcrossing );
595 * Is there an entry callback hooked to the window?
597 if( window->Callbacks.Entry != NULL )
600 * Set the current window
602 fgSetWindow ( window ) ;
605 * Yeah. Notify the window about having the mouse cursor over
607 window->Callbacks.Entry( GLUT_LEFT );
615 * The mouse cursor was moved...
617 GETWINDOW( xmotion ); GETMOUSE( xmotion );
620 * Fallback if there's an active menu hooked to this window
622 if( window->ActiveMenu != NULL )
625 * Let's make the window redraw as a result of the mouse motion.
627 window->State.Redisplay = TRUE ;
630 * Since the window is a menu, make the parent window current
632 fgSetWindow ( window->ActiveMenu->ParentWindow ) ;
638 * What kind of a movement was it?
640 if( (event.xmotion.state & Button1Mask) || (event.xmotion.state & Button2Mask) ||
641 (event.xmotion.state & Button3Mask) || (event.xmotion.state & Button4Mask) ||
642 (event.xmotion.state & Button5Mask) )
645 * A mouse button was pressed during the movement...
646 * Is there a motion callback hooked to the window?
648 if( window->Callbacks.Motion != NULL )
651 * Set the current window
653 fgSetWindow ( window ) ;
656 * Yup. Have it executed immediately
658 window->Callbacks.Motion( event.xmotion.x, event.xmotion.y );
664 * Otherwise it was a passive movement...
666 if( window->Callbacks.Passive != NULL )
669 * Set the current window
671 fgSetWindow ( window ) ;
674 * That's right, and there is a passive callback, too.
676 window->Callbacks.Passive( event.xmotion.x, event.xmotion.y );
685 GLboolean pressed = TRUE ;
688 if ( event.type == ButtonRelease ) pressed = FALSE ;
691 * A mouse button has been pressed or released. Traditionally,
692 * break if the window was found within the freeglut structures.
694 GETWINDOW( xbutton ); GETMOUSE( xbutton );
697 * GLUT API assumes that you can't have more than three mouse buttons, so:
699 switch( event.xbutton.button )
702 * WARNING: this might be wrong, if we only have two mouse buttons,
703 * Button2 might mean the right button, isn't that right?
705 case Button1: button = GLUT_LEFT_BUTTON; break;
706 case Button2: button = GLUT_MIDDLE_BUTTON; break;
707 case Button3: button = GLUT_RIGHT_BUTTON; break;
708 default: button = -1; break;
712 * Skip the unwanted mouse buttons...
718 * Do not execute the application's mouse callback if a menu is hooked to this button.
719 * In that case an appropriate private call should be generated.
720 * Near as I can tell, this is the menu behaviour:
721 * - Down-click the menu button, menu not active: activate the menu with its upper left-hand corner at the mouse location.
722 * - Down-click any button outside the menu, menu active: deactivate the menu
723 * - Down-click any button inside the menu, menu active: select the menu entry and deactivate the menu
724 * - Up-click the menu button, menu not active: nothing happens
725 * - Up-click the menu button outside the menu, menu active: nothing happens
726 * - Up-click the menu button inside the menu, menu active: select the menu entry and deactivate the menu
728 if ( window->ActiveMenu != NULL ) /* Window has an active menu, it absorbs any mouse click */
730 if ( fgCheckActiveMenu ( window, window->ActiveMenu ) == TRUE ) /* Inside the menu, invoke the callback and deactivate the menu*/
732 /* Save the current window and menu and set the current window to the window whose menu this is */
733 SFG_Window *save_window = fgStructure.Window ;
734 SFG_Menu *save_menu = fgStructure.Menu ;
735 SFG_Window *parent_window = window->ActiveMenu->ParentWindow ;
736 fgSetWindow ( window ) ;
737 fgStructure.Menu = window->ActiveMenu ;
739 /* Execute the menu callback */
740 fgExecuteMenuCallback ( window->ActiveMenu ) ;
741 fgDeactivateMenu ( parent_window ) ;
743 /* Restore the current window and menu */
744 fgSetWindow ( save_window ) ;
745 fgStructure.Menu = save_menu ;
747 else /* Outside the menu, deactivate the menu if it's a downclick */
749 if ( pressed == TRUE ) fgDeactivateMenu ( window->ActiveMenu->ParentWindow ) ;
753 * Let's make the window redraw as a result of the mouse click and menu activity.
755 window->State.Redisplay = TRUE ;
761 * No active menu, let's check whether we need to activate one.
763 if ( ( window->Menu[ button ] != NULL ) && ( pressed == TRUE ) )
766 * Let's make the window redraw as a result of the mouse click.
768 window->State.Redisplay = TRUE ;
771 * Set the current window
773 fgSetWindow( window );
776 * Activate the appropriate menu structure...
778 fgActivateMenu( window, button );
784 * Check if there is a mouse callback hooked to the window
786 if( window->Callbacks.Mouse == NULL )
790 * Set the current window
792 fgSetWindow ( window );
795 * Remember the current modifiers state
798 if (event.xbutton.state & (ShiftMask|LockMask))
799 modifiers |= GLUT_ACTIVE_SHIFT;
800 if (event.xbutton.state & ControlMask)
801 modifiers |= GLUT_ACTIVE_CTRL;
802 if (event.xbutton.state & Mod1Mask)
803 modifiers |= GLUT_ACTIVE_ALT;
804 fgStructure.Window->State.Modifiers = modifiers;
807 * Finally execute the mouse callback
809 fgStructure.Window->Callbacks.Mouse(
811 event.type == ButtonPress ? GLUT_DOWN : GLUT_UP,
817 * Trash the modifiers state
819 fgStructure.Window->State.Modifiers = 0xffffffff;
826 FGCBkeyboard keyboard_cb;
827 FGCBspecial special_cb;
830 * A key has been pressed, find the window that had the focus:
832 GETWINDOW( xkey ); GETMOUSE( xkey );
834 if( event.type == KeyPress )
836 keyboard_cb = window->Callbacks.Keyboard;
837 special_cb = window->Callbacks.Special;
841 keyboard_cb = window->Callbacks.KeyboardUp;
842 special_cb = window->Callbacks.SpecialUp;
846 * Is there a keyboard/special callback hooked for this window?
848 if( (keyboard_cb != NULL) || (special_cb != NULL) )
850 XComposeStatus composeStatus;
851 char asciiCode[ 32 ];
856 * Check for the ASCII/KeySym codes associated with the event:
858 len = XLookupString( &event.xkey, asciiCode, sizeof(asciiCode), &keySym, &composeStatus );
861 * GLUT API tells us to have two separate callbacks...
866 * ...one for the ASCII translateable keypresses...
868 if( keyboard_cb != NULL )
871 * Set the current window
873 fgSetWindow( window );
876 * Remember the current modifiers state
879 if (event.xkey.state & (ShiftMask|LockMask))
880 modifiers |= GLUT_ACTIVE_SHIFT;
881 if (event.xkey.state & ControlMask)
882 modifiers |= GLUT_ACTIVE_CTRL;
883 if (event.xkey.state & Mod1Mask)
884 modifiers |= GLUT_ACTIVE_ALT;
885 window->State.Modifiers = modifiers;
888 * Execute the callback
890 keyboard_cb( asciiCode[ 0 ], event.xkey.x, event.xkey.y );
893 * Trash the modifiers state
895 window->State.Modifiers = 0xffffffff;
903 * ...and one for all the others, which need to be translated to GLUT_KEY_Xs...
908 * First the function keys come:
910 case XK_F1: special = GLUT_KEY_F1; break;
911 case XK_F2: special = GLUT_KEY_F2; break;
912 case XK_F3: special = GLUT_KEY_F3; break;
913 case XK_F4: special = GLUT_KEY_F4; break;
914 case XK_F5: special = GLUT_KEY_F5; break;
915 case XK_F6: special = GLUT_KEY_F6; break;
916 case XK_F7: special = GLUT_KEY_F7; break;
917 case XK_F8: special = GLUT_KEY_F8; break;
918 case XK_F9: special = GLUT_KEY_F9; break;
919 case XK_F10: special = GLUT_KEY_F10; break;
920 case XK_F11: special = GLUT_KEY_F11; break;
921 case XK_F12: special = GLUT_KEY_F12; break;
924 * Then the arrows and stuff:
926 case XK_Left: special = GLUT_KEY_LEFT; break;
927 case XK_Right: special = GLUT_KEY_RIGHT; break;
928 case XK_Up: special = GLUT_KEY_UP; break;
929 case XK_Down: special = GLUT_KEY_DOWN; break;
932 case XK_Prior: special = GLUT_KEY_PAGE_UP; break;
934 case XK_Next: special = GLUT_KEY_PAGE_DOWN; break;
936 case XK_Home: special = GLUT_KEY_HOME; break;
938 case XK_End: special = GLUT_KEY_END; break;
940 case XK_Insert: special = GLUT_KEY_INSERT; break;
944 * Execute the callback (if one has been specified),
945 * given that the special code seems to be valid...
947 if( (special_cb != NULL) && (special != -1) )
950 * Set the current window
952 fgSetWindow( window );
955 * Remember the current modifiers state
958 if (event.xkey.state & (ShiftMask|LockMask))
959 modifiers |= GLUT_ACTIVE_SHIFT;
960 if (event.xkey.state & ControlMask)
961 modifiers |= GLUT_ACTIVE_CTRL;
962 if (event.xkey.state & Mod1Mask)
963 modifiers |= GLUT_ACTIVE_ALT;
964 window->State.Modifiers = modifiers;
966 special_cb( special, event.xkey.x, event.xkey.y );
969 * Trash the modifiers state
971 window->State.Modifiers = 0xffffffff;
982 * Have all the timers checked.
987 * Poll the joystick and notify all windows that want to be notified...
989 fghCheckJoystickPolls();
992 * No messages in the queue, which means we are idling...
994 if( fgState.IdleCallback != NULL )
995 fgState.IdleCallback();
998 * Remember about displaying all the windows that have
999 * been marked for a redisplay (possibly in the idle call):
1004 #elif TARGET_HOST_WIN32
1009 * The windows processing is considerably smaller
1011 if( PeekMessage( &stMsg, NULL, 0, 0, PM_NOREMOVE ) )
1014 * Grab the message now, checking for WM_QUIT
1016 if( GetMessage( &stMsg, NULL, 0, 0 ) == 0 )
1017 fgState.ExecState = GLUT_EXEC_STATE_STOP ;
1020 * Translate virtual-key messages and send them to the window...
1022 TranslateMessage( &stMsg );
1023 DispatchMessage( &stMsg );
1028 * Have all the timers checked.
1033 * Poll the joystick and notify all windows that want to be notified...
1035 fghCheckJoystickPolls();
1038 * No messages in the queue, which means we are idling...
1040 if( fgState.IdleCallback != NULL )
1041 fgState.IdleCallback();
1044 * Remember about displaying all the windows that have
1045 * been marked for a redisplay (possibly in the idle call):
1052 * If an event caused a window to be closed, do the actual closing here
1058 * Enters the freeglut processing loop. Stays until the "ExecState" changes to "GLUT_EXEC_STATE_STOP".
1060 void FGAPIENTRY glutMainLoop( void )
1062 #if TARGET_HOST_WIN32
1063 SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
1067 * Make sure the display has been created etc.
1069 freeglut_assert_ready;
1071 #if TARGET_HOST_WIN32
1073 * Processing before the main loop: If there is a window which is open and which
1074 * has a visibility callback, call it. I know this is an ugly hack, but I'm not sure
1075 * what else to do about it. Ideally we should leave something uninitialized in the
1076 * create window code and initialize it in the main loop, and have that initialization
1077 * create a "WM_ACTIVATE" message. Then we would put the visibility callback code in
1078 * the "case WM_ACTIVATE" block below. - John Fay -- 10/24/02
1080 while ( window != NULL )
1082 if ( window->Callbacks.Visibility != NULL )
1084 SFG_Window *current_window = fgStructure.Window ;
1087 * Set the current window
1089 fgSetWindow( window );
1091 window->Callbacks.Visibility ( window->State.Visible ) ;
1094 * Restore the current window
1096 fgSetWindow( current_window );
1099 window = (SFG_Window *)window->Node.Next ;
1104 * Set freeglut to be running
1106 fgState.ExecState = GLUT_EXEC_STATE_RUNNING ;
1109 * Enter the main loop itself. Inside the loop, process events and check for loop exit.
1111 while ( fgState.ExecState == GLUT_EXEC_STATE_RUNNING )
1113 glutMainLoopEvent () ;
1116 * If there are no more windows open, stop execution
1118 if ( fgStructure.Windows.First == NULL )
1119 fgState.ExecState = GLUT_EXEC_STATE_STOP ;
1123 fgExecutionState execState = fgState.ActionOnWindowClose;
1126 * When this loop terminates, destroy the display, state and structure
1127 * of a freeglut session, so that another glutInit() call can happen
1132 * Check whether we return to the calling program or simply exit
1134 if ( execState == GLUT_ACTION_EXIT )
1140 * Leaves the freeglut processing loop.
1142 void FGAPIENTRY glutLeaveMainLoop( void )
1144 fgState.ExecState = GLUT_EXEC_STATE_STOP ;
1148 * The window procedure for handling Win32 events
1150 #if TARGET_HOST_WIN32
1151 LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
1153 SFG_Window* window = fgWindowByHandle( hWnd );
1157 if ( ( window == NULL ) && ( uMsg != WM_CREATE ) )
1158 return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
1160 /* printf ( "Window %3d message <%04x> %12d %12d\n", window?window->ID:0, uMsg, wParam, lParam ) ; */
1162 * Check what type of message are we receiving
1168 * The window structure is passed as the creation structure paramter...
1170 window = (SFG_Window *) (((LPCREATESTRUCT) lParam)->lpCreateParams);
1171 assert( window != NULL );
1174 * We can safely store the window's handle now:
1176 window->Window.Handle = hWnd;
1179 * Get the window's device context
1181 window->Window.Device = GetDC( hWnd );
1184 * Create or get the OpenGL rendering context now
1186 if ( fgState.BuildingAMenu )
1189 * Setup the pixel format of our window
1191 unsigned int current_DisplayMode = fgState.DisplayMode ;
1192 fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH ;
1193 fgSetupPixelFormat( window, FALSE, PFD_MAIN_PLANE );
1194 fgState.DisplayMode = current_DisplayMode ;
1197 * If there isn't already an OpenGL rendering context for menu windows, make one
1199 if ( !fgStructure.MenuContext )
1201 fgStructure.MenuContext = (SFG_MenuContext *)malloc ( sizeof(SFG_MenuContext) ) ;
1202 fgStructure.MenuContext->Context = wglCreateContext( window->Window.Device );
1205 wglMakeCurrent ( window->Window.Device, fgStructure.MenuContext->Context ) ;
1207 /* window->Window.Context = wglGetCurrentContext () ; */
1208 window->Window.Context = wglCreateContext( window->Window.Device );
1213 * Setup the pixel format of our window
1215 fgSetupPixelFormat( window, FALSE, PFD_MAIN_PLANE );
1217 if ( fgState.UseCurrentContext == TRUE )
1219 window->Window.Context = wglGetCurrentContext();
1220 if ( ! window->Window.Context )
1221 window->Window.Context = wglCreateContext( window->Window.Device );
1224 window->Window.Context = wglCreateContext( window->Window.Device );
1228 * Still, we'll be needing to explicitly resize the window
1230 window->State.NeedToResize = TRUE;
1233 * Finally, have the window's device context released
1235 ReleaseDC( window->Window.Handle, window->Window.Device );
1240 * We got resized... But check if the window has been already added...
1242 fghReshapeWindowByHandle( hWnd, LOWORD(lParam), HIWORD(lParam) );
1246 printf("WM_SETFOCUS: %p\n", window );
1247 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
1251 if (LOWORD(wParam) != WA_INACTIVE)
1253 /* glutSetCursor( fgStructure.Window->State.Cursor ); */
1254 printf("WM_ACTIVATE: glutSetCursor( %p, %d)\n", window, window->State.Cursor );
1256 glutSetCursor( window->State.Cursor );
1259 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
1265 * Windows seems to need reminding to erase the cursor for NONE.
1268 if ((LOWORD(lParam) == HTCLIENT) &&
1269 (fgStructure.Window->State.Cursor == GLUT_CURSOR_NONE))
1272 /* Set the cursor AND change it for this window class. */
1273 # define MAP_CURSOR(a,b) case a: SetCursor( LoadCursor( NULL, b ) ); \
1275 /* Nuke the cursor AND change it for this window class. */
1276 # define ZAP_CURSOR(a,b) case a: SetCursor( NULL ); \
1279 if (LOWORD(lParam) == HTCLIENT)
1280 switch( window->State.Cursor )
1282 MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, IDC_ARROW );
1283 MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW, IDC_ARROW );
1284 MAP_CURSOR( GLUT_CURSOR_INFO, IDC_HELP );
1285 MAP_CURSOR( GLUT_CURSOR_DESTROY, IDC_CROSS );
1286 MAP_CURSOR( GLUT_CURSOR_HELP, IDC_HELP );
1287 MAP_CURSOR( GLUT_CURSOR_CYCLE, IDC_SIZEALL );
1288 MAP_CURSOR( GLUT_CURSOR_SPRAY, IDC_CROSS );
1289 MAP_CURSOR( GLUT_CURSOR_WAIT, IDC_WAIT );
1290 MAP_CURSOR( GLUT_CURSOR_TEXT, IDC_UPARROW );
1291 MAP_CURSOR( GLUT_CURSOR_CROSSHAIR, IDC_CROSS );
1292 /* MAP_CURSOR( GLUT_CURSOR_NONE, IDC_NO ); */
1293 ZAP_CURSOR( GLUT_CURSOR_NONE, NULL );
1296 MAP_CURSOR( GLUT_CURSOR_UP_DOWN, IDC_ARROW );
1300 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
1305 * We are now Visible!
1307 window->State.Visible = TRUE;
1308 window->State.Redisplay = TRUE;
1313 * Start the painting job
1316 BeginPaint( hWnd, &ps );
1319 * Call the engine's main frame drawing method
1321 fghRedrawWindowByHandle( hWnd );
1324 * End the painting job, release the device context
1326 EndPaint( hWnd, &ps );
1331 * Make sure we don't close a window with current context active
1333 if( fgStructure.Window == window )
1338 wglMakeCurrent( NULL, NULL );
1339 /* Step through the list of windows. If the rendering context is notbeing used
1340 * by another window, then we delete it.
1342 for ( iter = (SFG_Window *)fgStructure.Windows.First; iter; iter = (SFG_Window *)iter->Node.Next )
1344 if ( ( iter->Window.Context == window->Window.Context ) && ( iter != window ) )
1348 if ( used == FALSE ) wglDeleteContext( window->Window.Context );
1352 * Put on a linked list of windows to be removed after all the callbacks have returned
1354 fgAddToWindowDestroyList ( window, FALSE ) ;
1357 * Proceed with the window destruction
1359 DestroyWindow( hWnd );
1364 * The window already got destroyed, so don't bother with it.
1371 * The mouse cursor has moved. Remember the new mouse cursor's position
1373 window->State.MouseX = LOWORD( lParam );
1374 window->State.MouseY = HIWORD( lParam );
1377 * Fallback if there's an active menu hooked to this window
1379 if ( window->ActiveMenu != NULL )
1382 * Let's make the window redraw as a result of the mouse motion.
1384 window->State.Redisplay = TRUE ;
1387 * Since the window is a menu, make the parent window current
1389 fgSetWindow ( window->ActiveMenu->ParentWindow ) ;
1395 * Remember the current modifiers state.
1397 window->State.Modifiers =
1398 ( ( (GetKeyState( VK_LSHIFT ) < 0 ) || ( GetKeyState( VK_RSHIFT ) < 0 )) ? GLUT_ACTIVE_SHIFT : 0 ) |
1399 ( ( (GetKeyState( VK_LCONTROL ) < 0 ) || ( GetKeyState( VK_RCONTROL ) < 0 )) ? GLUT_ACTIVE_CTRL : 0 ) |
1400 ( ( (GetKeyState( VK_LMENU ) < 0 ) || ( GetKeyState( VK_RMENU ) < 0 )) ? GLUT_ACTIVE_ALT : 0 );
1403 * Check if any of the mouse buttons is pressed...
1405 if( (wParam & MK_LBUTTON) || (wParam & MK_MBUTTON) || (wParam & MK_RBUTTON) )
1408 * Yeah, indeed. We need to use the motion callback then:
1410 if( window->Callbacks.Motion != NULL )
1413 * Make sure the current window is set...
1415 fgSetWindow( window );
1418 * Execute the active mouse motion callback now
1420 window->Callbacks.Motion( window->State.MouseX, window->State.MouseY );
1426 * All mouse buttons are up, execute the passive mouse motion callback
1428 if( window->Callbacks.Passive != NULL )
1431 * Make sure the current window is set
1433 fgSetWindow( window );
1436 * Execute the passive mouse motion callback
1438 window->Callbacks.Passive( window->State.MouseX, window->State.MouseY );
1443 * Thrash the current modifiers state now
1445 window->State.Modifiers = 0xffffffff;
1449 case WM_LBUTTONDOWN:
1450 case WM_MBUTTONDOWN:
1451 case WM_RBUTTONDOWN:
1456 GLboolean pressed = TRUE;
1460 * The mouse cursor has moved. Remember the new mouse cursor's position
1462 window->State.MouseX = LOWORD( lParam );
1463 window->State.MouseY = HIWORD( lParam );
1466 * We're curious about the GLUT API button name...
1470 case WM_LBUTTONDOWN: pressed = TRUE; button = GLUT_LEFT_BUTTON; break;
1471 case WM_MBUTTONDOWN: pressed = TRUE; button = GLUT_MIDDLE_BUTTON; break;
1472 case WM_RBUTTONDOWN: pressed = TRUE; button = GLUT_RIGHT_BUTTON; break;
1473 case WM_LBUTTONUP: pressed = FALSE; button = GLUT_LEFT_BUTTON; break;
1474 case WM_MBUTTONUP: pressed = FALSE; button = GLUT_MIDDLE_BUTTON; break;
1475 case WM_RBUTTONUP: pressed = FALSE; button = GLUT_RIGHT_BUTTON; break;
1476 default: pressed = FALSE; button = -1; break;
1480 * The left and right mouse buttons might have been swapped...
1482 if( GetSystemMetrics( SM_SWAPBUTTON ) )
1483 if( button == GLUT_LEFT_BUTTON ) button = GLUT_RIGHT_BUTTON;
1484 else if( button == GLUT_RIGHT_BUTTON ) button = GLUT_LEFT_BUTTON;
1487 * Hey, what's up with you?
1490 return( DefWindowProc( hWnd, uMsg, lParam, wParam ) );
1493 * Do not execute the application's mouse callback if a menu is hooked to this button.
1494 * In that case an appropriate private call should be generated.
1495 * Near as I can tell, this is the menu behaviour:
1496 * - Down-click the menu button, menu not active: activate the menu with its upper left-hand corner at the mouse location.
1497 * - Down-click any button outside the menu, menu active: deactivate the menu
1498 * - Down-click any button inside the menu, menu active: select the menu entry and deactivate the menu
1499 * - Up-click the menu button, menu not active: nothing happens
1500 * - Up-click the menu button outside the menu, menu active: nothing happens
1501 * - Up-click the menu button inside the menu, menu active: select the menu entry and deactivate the menu
1503 if ( window->ActiveMenu != NULL ) /* Window has an active menu, it absorbs any mouse click */
1505 if ( fgCheckActiveMenu ( window, window->ActiveMenu ) == TRUE ) /* Inside the menu, invoke the callback and deactivate the menu*/
1507 /* Save the current window and menu and set the current window to the window whose menu this is */
1508 SFG_Window *save_window = fgStructure.Window ;
1509 SFG_Menu *save_menu = fgStructure.Menu ;
1510 SFG_Window *parent_window = window->ActiveMenu->ParentWindow ;
1511 fgSetWindow ( window ) ;
1512 fgStructure.Menu = window->ActiveMenu ;
1514 /* Execute the menu callback */
1515 fgExecuteMenuCallback ( window->ActiveMenu ) ;
1516 fgDeactivateMenu ( parent_window ) ;
1518 /* Restore the current window and menu */
1519 fgSetWindow ( save_window ) ;
1520 fgStructure.Menu = save_menu ;
1522 else /* Outside the menu, deactivate the menu if it's a downclick */
1524 if ( pressed == TRUE ) fgDeactivateMenu ( window->ActiveMenu->ParentWindow ) ;
1528 * Let's make the window redraw as a result of the mouse click and menu activity.
1530 if ( ! window->IsMenu ) window->State.Redisplay = TRUE ;
1536 * No active menu, let's check whether we need to activate one.
1538 if ( ( window->Menu[ button ] != NULL ) && ( pressed == TRUE ) )
1541 * Let's make the window redraw as a result of the mouse click.
1543 window->State.Redisplay = TRUE ;
1546 * Set the current window
1548 fgSetWindow( window );
1551 * Activate the appropriate menu structure...
1553 fgActivateMenu( window, button );
1559 * Check if there is a mouse callback hooked to the window
1561 if( window->Callbacks.Mouse == NULL )
1565 * Set the current window
1567 fgSetWindow ( window );
1570 * Remember the current modifiers state.
1572 fgStructure.Window->State.Modifiers =
1573 ( ( (GetKeyState( VK_LSHIFT ) < 0 ) || ( GetKeyState( VK_RSHIFT ) < 0 )) ? GLUT_ACTIVE_SHIFT : 0 ) |
1574 ( ( (GetKeyState( VK_LCONTROL ) < 0 ) || ( GetKeyState( VK_RCONTROL ) < 0 )) ? GLUT_ACTIVE_CTRL : 0 ) |
1575 ( ( (GetKeyState( VK_LMENU ) < 0 ) || ( GetKeyState( VK_RMENU ) < 0 )) ? GLUT_ACTIVE_ALT : 0 );
1578 * Finally execute the mouse callback
1580 window->Callbacks.Mouse(
1582 pressed == TRUE ? GLUT_DOWN : GLUT_UP,
1583 window->State.MouseX,
1584 window->State.MouseY
1588 * Trash the modifiers state
1590 fgStructure.Window->State.Modifiers = 0xffffffff;
1601 * Ignore the automatic key repetition if needed:
1603 if( fgState.IgnoreKeyRepeat && (lParam & KF_REPEAT) )
1607 * Remember the current modifiers state. This is done here in order
1608 * to make sure the VK_DELETE keyboard callback is executed properly.
1610 window->State.Modifiers =
1611 ( ( (GetKeyState( VK_LSHIFT ) < 0 ) || ( GetKeyState( VK_RSHIFT ) < 0 )) ? GLUT_ACTIVE_SHIFT : 0 ) |
1612 ( ( (GetKeyState( VK_LCONTROL ) < 0 ) || ( GetKeyState( VK_RCONTROL ) < 0 )) ? GLUT_ACTIVE_CTRL : 0 ) |
1613 ( ( (GetKeyState( VK_LMENU ) < 0 ) || ( GetKeyState( VK_RMENU ) < 0 )) ? GLUT_ACTIVE_ALT : 0 );
1616 * Set the mouse position
1618 GetCursorPos ( &mouse_pos ) ;
1619 ScreenToClient ( window->Window.Handle, &mouse_pos ) ;
1621 window->State.MouseX = mouse_pos.x ;
1622 window->State.MouseY = mouse_pos.y ;
1625 * Convert the Win32 keystroke codes to GLUTtish way
1627 # define KEY(a,b) case a: keypress = b; break;
1632 * Most of the special characters can be handled automagically...
1634 KEY( VK_F1, GLUT_KEY_F1 ); KEY( VK_F2, GLUT_KEY_F2 );
1635 KEY( VK_F3, GLUT_KEY_F3 ); KEY( VK_F4, GLUT_KEY_F4 );
1636 KEY( VK_F5, GLUT_KEY_F5 ); KEY( VK_F6, GLUT_KEY_F6 );
1637 KEY( VK_F7, GLUT_KEY_F7 ); KEY( VK_F8, GLUT_KEY_F8 );
1638 KEY( VK_F9, GLUT_KEY_F9 ); KEY( VK_F10, GLUT_KEY_F10 );
1639 KEY( VK_F11, GLUT_KEY_F11 ); KEY( VK_F12, GLUT_KEY_F12 );
1640 KEY( VK_PRIOR, GLUT_KEY_PAGE_UP ); KEY( VK_NEXT, GLUT_KEY_PAGE_DOWN );
1641 KEY( VK_HOME, GLUT_KEY_HOME ); KEY( VK_END, GLUT_KEY_END );
1642 KEY( VK_LEFT, GLUT_KEY_LEFT ); KEY( VK_UP, GLUT_KEY_UP );
1643 KEY( VK_RIGHT, GLUT_KEY_RIGHT ); KEY( VK_DOWN, GLUT_KEY_DOWN );
1644 KEY( VK_INSERT, GLUT_KEY_INSERT );
1647 * ...yet there is a small exception we need to have handled...
1651 * The delete key should be treated as an ASCII keypress:
1653 if( window->Callbacks.Keyboard != NULL )
1655 fgSetWindow( window );
1656 window->Callbacks.Keyboard( 127, window->State.MouseX, window->State.MouseY );
1661 * Execute the special callback, if present, given the conversion was a success:
1663 if( (keypress != -1) && (window->Callbacks.Special != NULL) )
1666 * Set the current window
1668 fgSetWindow( window );
1671 * Have the special callback executed:
1673 window->Callbacks.Special( keypress, window->State.MouseX, window->State.MouseY );
1677 * Thrash the modifiers register now
1679 window->State.Modifiers = 0xffffffff;
1690 * Remember the current modifiers state. This is done here in order
1691 * to make sure the VK_DELETE keyboard callback is executed properly.
1693 window->State.Modifiers =
1694 ( ( (GetKeyState( VK_LSHIFT ) < 0 ) || ( GetKeyState( VK_RSHIFT ) < 0 )) ? GLUT_ACTIVE_SHIFT : 0 ) |
1695 ( ( (GetKeyState( VK_LCONTROL ) < 0 ) || ( GetKeyState( VK_RCONTROL ) < 0 )) ? GLUT_ACTIVE_CTRL : 0 ) |
1696 ( ( (GetKeyState( VK_LMENU ) < 0 ) || ( GetKeyState( VK_RMENU ) < 0 )) ? GLUT_ACTIVE_ALT : 0 );
1699 * Set the mouse position
1701 GetCursorPos ( &mouse_pos ) ;
1702 ScreenToClient ( window->Window.Handle, &mouse_pos ) ;
1704 window->State.MouseX = mouse_pos.x ;
1705 window->State.MouseY = mouse_pos.y ;
1708 * Convert the Win32 keystroke codes to GLUTtish way. "KEY(a,b)" was defined under "WM_KEYDOWN"
1714 * Most of the special characters can be handled automagically...
1716 KEY( VK_F1, GLUT_KEY_F1 ); KEY( VK_F2, GLUT_KEY_F2 );
1717 KEY( VK_F3, GLUT_KEY_F3 ); KEY( VK_F4, GLUT_KEY_F4 );
1718 KEY( VK_F5, GLUT_KEY_F5 ); KEY( VK_F6, GLUT_KEY_F6 );
1719 KEY( VK_F7, GLUT_KEY_F7 ); KEY( VK_F8, GLUT_KEY_F8 );
1720 KEY( VK_F9, GLUT_KEY_F9 ); KEY( VK_F10, GLUT_KEY_F10 );
1721 KEY( VK_F11, GLUT_KEY_F11 ); KEY( VK_F12, GLUT_KEY_F12 );
1722 KEY( VK_PRIOR, GLUT_KEY_PAGE_UP ); KEY( VK_NEXT, GLUT_KEY_PAGE_DOWN );
1723 KEY( VK_HOME, GLUT_KEY_HOME ); KEY( VK_END, GLUT_KEY_END );
1724 KEY( VK_LEFT, GLUT_KEY_LEFT ); KEY( VK_UP, GLUT_KEY_UP );
1725 KEY( VK_RIGHT, GLUT_KEY_RIGHT ); KEY( VK_DOWN, GLUT_KEY_DOWN );
1726 KEY( VK_INSERT, GLUT_KEY_INSERT );
1729 * ...yet there is a small exception we need to have handled...
1733 * The delete key should be treated as an ASCII keypress:
1735 if( window->Callbacks.KeyboardUp != NULL )
1737 fgSetWindow ( window ) ;
1738 window->Callbacks.KeyboardUp( 127, window->State.MouseX, window->State.MouseY );
1745 * Call the KeyboardUp callback for a regular character if there is one.
1750 GetKeyboardState(state);
1752 if ( ToAscii( wParam, 0, state, code, 0 ) == 1 )
1755 if( window->Callbacks.KeyboardUp != NULL )
1758 * Set the current window
1760 fgSetWindow( window );
1762 window->Callbacks.KeyboardUp( (char)wParam, window->State.MouseX, window->State.MouseY );
1768 * Execute the special callback, if present, given the conversion was a success:
1770 if( (keypress != -1) && (window->Callbacks.SpecialUp != NULL) )
1773 * Set the current window
1775 fgSetWindow( window );
1778 * Have the special callback executed:
1780 window->Callbacks.SpecialUp( keypress, window->State.MouseX, window->State.MouseY );
1784 * Thrash the modifiers register now
1786 window->State.Modifiers = 0xffffffff;
1794 * Ignore the automatic key repetition if needed:
1796 if( fgState.IgnoreKeyRepeat && (lParam & KF_REPEAT) )
1800 * Clear to go with the keyboard callback, if registered:
1802 if( window->Callbacks.Keyboard != NULL )
1805 * Set the current window
1807 fgSetWindow( window );
1810 * Remember the current modifiers state
1812 window->State.Modifiers =
1813 ( ( (GetKeyState( VK_LSHIFT ) < 0 ) || ( GetKeyState( VK_RSHIFT ) < 0 )) ? GLUT_ACTIVE_SHIFT : 0 ) |
1814 ( ( (GetKeyState( VK_LCONTROL ) < 0 ) || ( GetKeyState( VK_RCONTROL ) < 0 )) ? GLUT_ACTIVE_CTRL : 0 ) |
1815 ( ( (GetKeyState( VK_LMENU ) < 0 ) || ( GetKeyState( VK_RMENU ) < 0 )) ? GLUT_ACTIVE_ALT : 0 );
1818 * Have the special callback executed:
1820 window->Callbacks.Keyboard( (char)wParam, window->State.MouseX, window->State.MouseY );
1823 * Thrash the modifiers register now
1825 window->State.Modifiers = 0xffffffff;
1830 case WM_CAPTURECHANGED : /* User has finished resizing the window, force a redraw */
1831 if ( window->Callbacks.Display )
1834 * Set the current window
1836 fgSetWindow( window );
1838 window->Callbacks.Display () ;
1841 /* lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ) ; */
1845 * Other messages that I have seen and which are not handled already
1847 case WM_SETTEXT : /* 0x000c */
1848 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); /* Pass it on to "DefWindowProc" to set the window text */
1851 case WM_GETTEXT : /* 0x000d */
1852 /* Ideally we would copy the title of the window into "lParam" */
1853 /* strncpy ( (char *)lParam, "Window Title", wParam ) ;
1854 lRet = ( wParam > 12 ) ? 12 : wParam ; */ /* the number of characters copied */
1855 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
1858 case WM_GETTEXTLENGTH : /* 0x000e */
1859 /* Ideally we would get the length of the title of the window */
1860 lRet = 12 ; /* the number of characters in "Window Title\0" (see above) */
1863 case WM_ERASEBKGND : /* 0x0014 */
1864 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
1867 case WM_SYNCPAINT : /* 0x0088 */
1868 /* Another window has moved, need to update this one */
1869 window->State.Redisplay = TRUE ;
1870 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); /* Help screen says this message must be passed to "DefWindowProc" */
1873 case WM_NCPAINT : /* 0x0085 */
1874 /* Need to update the border of this window */
1875 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); /* Pass it on to "DefWindowProc" to repaint a standard border */
1880 * Handle unhandled messages
1882 lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
1890 /*** END OF FILE ***/