#include <GL/freeglut.h>
#include "freeglut_internal.h"
-#if HAVE_ERRNO_H
-# include <errno.h>
-#endif
+#include <errno.h>
#include <stdarg.h>
#if HAVE_VPRINTF
# define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
*/
static void fghReshapeWindow ( SFG_Window *window, int width, int height )
{
- SFG_Window *current_window = fgStructure.Window;
+ SFG_Window *current_window = fgStructure.CurrentWindow;
freeglut_return_if_fail( window != NULL );
*/
static void fghRedrawWindow ( SFG_Window *window )
{
- SFG_Window *current_window = fgStructure.Window;
+ SFG_Window *current_window = fgStructure.CurrentWindow;
freeglut_return_if_fail( window );
freeglut_return_if_fail( FETCH_WCB ( *window, Display ) );
wait.tv_usec = (msec % 1000) * 1000;
err = select( socket+1, &fdset, NULL, NULL, &wait );
- if( -1 == err )
+ if( ( -1 == err ) && ( errno != EINTR ) )
fgWarning ( "freeglut select() error: %d", errno );
}
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
{
if ( FETCH_WCB( *window, Visibility ) )
{
- SFG_Window *current_window = fgStructure.Window ;
+ SFG_Window *current_window = fgStructure.CurrentWindow ;
INVOKE_WCB( *window, Visibility, ( window->State.Visible ) );
fgSetWindow( current_window );
case WM_ACTIVATE:
if (LOWORD(wParam) != WA_INACTIVE)
{
- /* glutSetCursor( fgStructure.Window->State.Cursor ); */
-/* printf("WM_ACTIVATE: glutSetCursor( %p, %d)\n", window,
+/* printf("WM_ACTIVATE: fgSetCursor( %p, %d)\n", window,
window->State.Cursor ); */
- glutSetCursor( window->State.Cursor );
+ fgSetCursor( window, window->State.Cursor );
}
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
break;
#endif
- /*
- * 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 glutSetCursor() instead of defining two macros
- * XXX and implementing a nested case in-line.
- */
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;
-
- /* Nuke the cursor AND change it for this window class. */
-#define ZAP_CURSOR(a,b) \
- case a: \
- SetCursor( NULL ); \
- break;
-
/* printf ( "Cursor event %x %x %x %x\n", window, window->State.Cursor, lParam, wParam ) ; */
if( LOWORD( lParam ) == HTCLIENT )
- switch( window->State.Cursor )
- {
- MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, IDC_ARROW );
- MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW, IDC_ARROW );
- MAP_CURSOR( GLUT_CURSOR_INFO, IDC_HELP );
- MAP_CURSOR( GLUT_CURSOR_DESTROY, IDC_CROSS );
- MAP_CURSOR( GLUT_CURSOR_HELP, IDC_HELP );
- MAP_CURSOR( GLUT_CURSOR_CYCLE, IDC_SIZEALL );
- MAP_CURSOR( GLUT_CURSOR_SPRAY, IDC_CROSS );
- MAP_CURSOR( GLUT_CURSOR_WAIT, IDC_WAIT );
- MAP_CURSOR( GLUT_CURSOR_TEXT, IDC_UPARROW );
- MAP_CURSOR( GLUT_CURSOR_CROSSHAIR, IDC_CROSS );
- /* MAP_CURSOR( GLUT_CURSOR_NONE, IDC_NO ); */
- ZAP_CURSOR( GLUT_CURSOR_NONE, NULL );
-
- default:
- MAP_CURSOR( GLUT_CURSOR_UP_DOWN, IDC_ARROW );
- }
+ fgSetCursor ( window, window->State.Cursor ) ;
else
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
break;
*/
return 0;
+ /* XXX For a future patch: we need a mouse entry event. Unfortunately Windows
+ * XXX doesn't give us one, so we will probably need a "MouseInWindow" flag in
+ * XXX the SFG_Window structure. Set it to true to begin with and then have the
+ * XXX WM_MOUSELEAVE code set it to false. Then when we get a WM_MOUSEMOVE event,
+ * XXX if the flag is false we invoke the Entry callback and set the flag to true.
+ */
+ case 0x02a2: /* This is the message we get when the mouse is leaving the window */
+ INVOKE_WCB( *window, Entry, ( GLUT_LEFT ) );
+ break ;
+
case WM_MOUSEMOVE:
{
#if TARGET_HOST_WINCE
window->State.MouseX, window->State.MouseY ) )
break;
- if( window->Menu[ button ] && pressed )
- {
- window->State.Redisplay = GL_TRUE;
- fgSetWindow( window );
- fgActivateMenu( window, button );
-
- break;
- }
-
/* Set capture so that the window captures all the mouse messages */
/*
* XXX - Multiple button support: Under X11, the mouse is not released