* Print a warning message?
*/
{
- Cursor cursor;
+ Cursor cursor;
#define MAP_CURSOR(a,b) case a: cursor = XCreateFontCursor( fgDisplay.Display, b ); break;
- if( GLUT_CURSOR_FULL_CROSSHAIR == cursorID )
- cursorID = GLUT_CURSOR_CROSSHAIR;
-
- switch( cursorID )
+ if( GLUT_CURSOR_FULL_CROSSHAIR == cursorID )
+ cursorID = GLUT_CURSOR_CROSSHAIR;
+
+ switch( cursorID )
{
- MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, XC_right_ptr);
- MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW, XC_left_ptr);
- MAP_CURSOR( GLUT_CURSOR_INFO, XC_hand1);
- MAP_CURSOR( GLUT_CURSOR_DESTROY, XC_pirate);
- MAP_CURSOR( GLUT_CURSOR_HELP, XC_question_arrow);
- MAP_CURSOR( GLUT_CURSOR_CYCLE, XC_exchange);
- MAP_CURSOR( GLUT_CURSOR_SPRAY, XC_spraycan);
- MAP_CURSOR( GLUT_CURSOR_WAIT, XC_watch);
- MAP_CURSOR( GLUT_CURSOR_TEXT, XC_xterm);
- MAP_CURSOR( GLUT_CURSOR_CROSSHAIR, XC_crosshair);
- MAP_CURSOR( GLUT_CURSOR_UP_DOWN, XC_sb_v_double_arrow);
- MAP_CURSOR( GLUT_CURSOR_LEFT_RIGHT, XC_sb_h_double_arrow);
- MAP_CURSOR( GLUT_CURSOR_TOP_SIDE, XC_top_side);
- MAP_CURSOR( GLUT_CURSOR_BOTTOM_SIDE, XC_bottom_side);
- MAP_CURSOR( GLUT_CURSOR_LEFT_SIDE, XC_left_side);
- MAP_CURSOR( GLUT_CURSOR_RIGHT_SIDE, XC_right_side);
- MAP_CURSOR( GLUT_CURSOR_TOP_LEFT_CORNER, XC_top_left_corner);
- MAP_CURSOR( GLUT_CURSOR_TOP_RIGHT_CORNER, XC_top_right_corner);
- MAP_CURSOR( GLUT_CURSOR_BOTTOM_RIGHT_CORNER, XC_bottom_right_corner);
- MAP_CURSOR( GLUT_CURSOR_BOTTOM_LEFT_CORNER, XC_bottom_left_corner);
- MAP_CURSOR( GLUT_CURSOR_NONE, XC_bogosity);
- case GLUT_CURSOR_INHERIT:
- break;
- default:
- return;
- }
-
- if( GLUT_CURSOR_INHERIT == cursorID )
- XUndefineCursor( fgDisplay.Display, fgStructure.Window->Window.Handle );
- else
- XDefineCursor( fgDisplay.Display, fgStructure.Window->Window.Handle, cursor );
+ MAP_CURSOR( GLUT_CURSOR_RIGHT_ARROW, XC_right_ptr);
+ MAP_CURSOR( GLUT_CURSOR_LEFT_ARROW, XC_left_ptr);
+ MAP_CURSOR( GLUT_CURSOR_INFO, XC_hand1);
+ MAP_CURSOR( GLUT_CURSOR_DESTROY, XC_pirate);
+ MAP_CURSOR( GLUT_CURSOR_HELP, XC_question_arrow);
+ MAP_CURSOR( GLUT_CURSOR_CYCLE, XC_exchange);
+ MAP_CURSOR( GLUT_CURSOR_SPRAY, XC_spraycan);
+ MAP_CURSOR( GLUT_CURSOR_WAIT, XC_watch);
+ MAP_CURSOR( GLUT_CURSOR_TEXT, XC_xterm);
+ MAP_CURSOR( GLUT_CURSOR_CROSSHAIR, XC_crosshair);
+ MAP_CURSOR( GLUT_CURSOR_UP_DOWN, XC_sb_v_double_arrow);
+ MAP_CURSOR( GLUT_CURSOR_LEFT_RIGHT, XC_sb_h_double_arrow);
+ MAP_CURSOR( GLUT_CURSOR_TOP_SIDE, XC_top_side);
+ MAP_CURSOR( GLUT_CURSOR_BOTTOM_SIDE, XC_bottom_side);
+ MAP_CURSOR( GLUT_CURSOR_LEFT_SIDE, XC_left_side);
+ MAP_CURSOR( GLUT_CURSOR_RIGHT_SIDE, XC_right_side);
+ MAP_CURSOR( GLUT_CURSOR_TOP_LEFT_CORNER, XC_top_left_corner);
+ MAP_CURSOR( GLUT_CURSOR_TOP_RIGHT_CORNER, XC_top_right_corner);
+ MAP_CURSOR( GLUT_CURSOR_BOTTOM_RIGHT_CORNER, XC_bottom_right_corner);
+ MAP_CURSOR( GLUT_CURSOR_BOTTOM_LEFT_CORNER, XC_bottom_left_corner);
+ MAP_CURSOR( GLUT_CURSOR_NONE, XC_bogosity);
+ case GLUT_CURSOR_INHERIT:
+ break;
+ default:
+ return;
+ }
+
+ if( GLUT_CURSOR_INHERIT == cursorID )
+ XUndefineCursor( fgDisplay.Display, fgStructure.Window->Window.Handle );
+ else
+ XDefineCursor( fgDisplay.Display, fgStructure.Window->Window.Handle, cursor );
}
#elif TARGET_HOST_WIN32
* This is a temporary solution only...
*/
/* Set the cursor AND change it for this window class. */
-# define MAP_CURSOR(a,b) case a: SetCursor( LoadCursor( NULL, b ) ); \
+# define MAP_CURSOR(a,b) case a: SetCursor( LoadCursor( NULL, b ) ); \
SetClassLong(fgStructure.Window->Window.Handle,GCL_HCURSOR,(LONG)LoadCursor(NULL,b)); \
break;
- /* Nuke the cursor AND change it for this window class. */
-# define ZAP_CURSOR(a,b) case a: SetCursor( NULL ); \
+ /* Nuke the cursor AND change it for this window class. */
+# define ZAP_CURSOR(a,b) case a: SetCursor( NULL ); \
SetClassLong(fgStructure.Window->Window.Handle,GCL_HCURSOR,(LONG)NULL); \
break;
- switch( cursorID )
- {
- 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 );
- }
+ switch( cursorID )
+ {
+ 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 );
+ }
#endif
fgStructure.Window->State.Cursor = cursorID;
* restore the ViewPort on LeaveGameMode():
*/
XF86VidModeGetViewPort(
- fgDisplay.Display,
- fgDisplay.Screen,
- &fgDisplay.DisplayViewPortX,
- &fgDisplay.DisplayViewPortY
+ fgDisplay.Display,
+ fgDisplay.Screen,
+ &fgDisplay.DisplayViewPortX,
+ &fgDisplay.DisplayViewPortY
);
/*
* for restoring it later:
*/
{
- Window junk_window;
- unsigned int mask;
-
- XQueryPointer(
- fgDisplay.Display, fgDisplay.RootWindow,
- &junk_window, &junk_window,
- &fgDisplay.DisplayPointerX, &fgDisplay.DisplayPointerY,
- &fgDisplay.DisplayPointerX, &fgDisplay.DisplayPointerY, &mask
- );
+ Window junk_window;
+ unsigned int mask;
+
+ XQueryPointer(
+ fgDisplay.Display, fgDisplay.RootWindow,
+ &junk_window, &junk_window,
+ &fgDisplay.DisplayPointerX, &fgDisplay.DisplayPointerY,
+ &fgDisplay.DisplayPointerX, &fgDisplay.DisplayPointerY, &mask
+ );
}
/*
);
if (!fgDisplay.DisplayModeValid)
- fgWarning( "Runtime use of XF86VidModeGetModeLine failed.\n" );
+ fgWarning( "Runtime use of XF86VidModeGetModeLine failed.\n" );
# else
# warning fghRememberState: missing XFree86 video mode extensions, game mode will not change screen resolution when activated
* Restore the remembered pointer position:
*/
XWarpPointer(
- fgDisplay.Display, None, fgDisplay.RootWindow, 0, 0, 0, 0,
- fgDisplay.DisplayPointerX, fgDisplay.DisplayPointerY
+ fgDisplay.Display, None, fgDisplay.RootWindow, 0, 0, 0, 0,
+ fgDisplay.DisplayPointerX, fgDisplay.DisplayPointerY
);
/*
displayModes[ i ]
);
- /*
- * Now we can restore the remembered ViewPort:
- */
- XF86VidModeSetViewPort(
- fgDisplay.Display,
- fgDisplay.Screen,
- fgDisplay.DisplayViewPortX,
- fgDisplay.DisplayViewPortY
- );
-
- /*
- * For the case this would be the last X11 call the application
- * calls exit() we've to flush the X11 output queue to have the
- * commands sent to the X server before the application exists.
- */
- XFlush(fgDisplay.Display);
+ /*
+ * Now we can restore the remembered ViewPort:
+ */
+ XF86VidModeSetViewPort(
+ fgDisplay.Display,
+ fgDisplay.Screen,
+ fgDisplay.DisplayViewPortX,
+ fgDisplay.DisplayViewPortY
+ );
+
+ /*
+ * For the case this would be the last X11 call the application
+ * calls exit() we've to flush the X11 output queue to have the
+ * commands sent to the X server before the application exists.
+ */
+ XFlush(fgDisplay.Display);
return;
}
if( fghCheckDisplayMode( displayModes[ i ]->hdisplay, displayModes[ i ]->vdisplay,
fgState.GameModeDepth, fgState.GameModeRefresh ) )
{
- if( haveToTest )
- return( TRUE );
+ if( haveToTest )
+ return( TRUE );
/*
* OKi, this is the display mode we have been looking for...
*/
mode = displayModes;
break;
}
-
+
/*
* Switch to the next display mode, if any
*/
*/
if( fghChangeDisplayMode( FALSE ) == FALSE )
{
- fgWarning( "failed to change screen settings" );
+ fgWarning( "failed to change screen settings" );
return( FALSE );
}
/* Move the Pointer to the middle of the fullscreen window */
XWarpPointer(
- fgDisplay.Display,
- None,
- fgDisplay.RootWindow,
- 0, 0, 0, 0,
- fgState.GameModeSize.X/2, fgState.GameModeSize.Y/2
+ fgDisplay.Display,
+ None,
+ fgDisplay.RootWindow,
+ 0, 0, 0, 0,
+ fgState.GameModeSize.X/2, fgState.GameModeSize.Y/2
);
/*
* the application which we have to aviod, so wait until it's viewable:
*/
while (GrabSuccess != XGrabPointer(
- fgDisplay.Display, fgStructure.GameMode->Window.Handle,
- TRUE, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask
- |PointerMotionMask,
- GrabModeAsync, GrabModeAsync,
- fgStructure.GameMode->Window.Handle, None, CurrentTime)) {
- usleep (100);
+ fgDisplay.Display, fgStructure.GameMode->Window.Handle,
+ TRUE, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask
+ |PointerMotionMask,
+ GrabModeAsync, GrabModeAsync,
+ fgStructure.GameMode->Window.Handle, None, CurrentTime)) {
+ usleep (100);
}
/*
# ifdef X_XF86VidModeSetViewPort
if (fgDisplay.DisplayModeValid) {
- int x, y;
- Window child;
+ int x, y;
+ Window child;
- /*
- * Change to viewport to the window topleft edge:
- */
- XF86VidModeSetViewPort(fgDisplay.Display, fgDisplay.Screen, 0, 0);
+ /*
+ * Change to viewport to the window topleft edge:
+ */
+ XF86VidModeSetViewPort(fgDisplay.Display, fgDisplay.Screen, 0, 0);
- /*
- * Final window repositioning: It could be avoided using an undecorated
- * window using override_redirect, but this * would possily require more
- * changes and investigation.
- */
+ /*
+ * Final window repositioning: It could be avoided using an undecorated
+ * window using override_redirect, but this * would possily require more
+ * changes and investigation.
+ */
/* Get the current postion of the drawable area on screen */
- XTranslateCoordinates(
- fgDisplay.Display,
- fgStructure.Window->Window.Handle,
- fgDisplay.RootWindow,
- 0, 0, &x, &y,
- &child
- );
-
- /* Move the decorataions out of the topleft corner of the display */
- XMoveWindow(fgDisplay.Display, fgStructure.Window->Window.Handle, -x, -y);
+ XTranslateCoordinates(
+ fgDisplay.Display,
+ fgStructure.Window->Window.Handle,
+ fgDisplay.RootWindow,
+ 0, 0, &x, &y,
+ &child
+ );
+
+ /* Move the decorataions out of the topleft corner of the display */
+ XMoveWindow(fgDisplay.Display, fgStructure.Window->Window.Handle, -x, -y);
}
#endif