* apart from the windowing system version.
*/
-/* -- INTERNAL FUNCTIONS --------------------------------------------------- */
+/* -- PRIVATE FUNCTIONS --------------------------------------------------- */
#if TARGET_HOST_UNIX_X11
/*
};
#endif
-/* -- INTERFACE FUNCTIONS -------------------------------------------------- */
+/* -- INTERNAL FUNCTIONS ---------------------------------------------------- */
/*
* Set the cursor image to be used for the current window
*/
-void FGAPIENTRY glutSetCursor( int cursorID )
+void fgSetCursor ( SFG_Window *window, int cursorID )
{
- FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetCursor" );
- FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetCursor" );
-
#if TARGET_HOST_UNIX_X11
{
Cursor cursor;
}
}
- if ( ( cursorIDToUse != GLUT_CURSOR_NONE ) && ( cursor == None ) ) {
+ if ( cursorIDToUse == GLUT_CURSOR_INHERIT ) {
+ XUndefineCursor( fgDisplay.Display, window->Window.Handle );
+ } else if ( cursor != None ) {
+ XDefineCursor( fgDisplay.Display, window->Window.Handle, cursor );
+ } else if ( cursorIDToUse != GLUT_CURSOR_NONE ) {
fgError( "Failed to create cursor" );
}
- XDefineCursor( fgDisplay.Display,
- fgStructure.Window->Window.Handle, cursor );
}
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
# define MAP_CURSOR(a,b) \
case a: \
SetCursor( LoadCursor( NULL, b ) ); \
- SetClassLong( fgStructure.Window->Window.Handle, \
+ SetClassLong( window->Window.Handle, \
GCL_HCURSOR, \
( LONG )LoadCursor( NULL, b ) ); \
break;
# define ZAP_CURSOR(a,b) \
case a: \
SetCursor( NULL ); \
- SetClassLong( fgStructure.Window->Window.Handle, \
+ SetClassLong( window->Window.Handle, \
GCL_HCURSOR, ( LONG )NULL ); \
break;
}
#endif
- fgStructure.Window->State.Cursor = cursorID;
+ window->State.Cursor = cursorID;
+}
+
+/* -- INTERFACE FUNCTIONS -------------------------------------------------- */
+
+/*
+ * Set the cursor image to be used for the current window
+ */
+void FGAPIENTRY glutSetCursor( int cursorID )
+{
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetCursor" );
+ FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetCursor" );
+
+ fgSetCursor ( fgStructure.CurrentWindow, cursorID );
}
/*
XWarpPointer(
fgDisplay.Display,
None,
- fgStructure.Window->Window.Handle,
+ fgStructure.CurrentWindow->Window.Handle,
0, 0, 0, 0,
x, y
);
coords.y = y;
/* ClientToScreen() translates {coords} for us. */
- ClientToScreen( fgStructure.Window->Window.Handle, &coords );
+ ClientToScreen( fgStructure.CurrentWindow->Window.Handle, &coords );
SetCursorPos( coords.x, coords.y );
}