* XXX application has not already done so. The "freeglut" community
* XXX decided not to go this route (freeglut-developer e-mail from
* XXX Steve Baker, 12/16/04, 4:22 PM CST, "Re: [Freeglut-developer]
- * XXX Desired 'freeglut' behaviour when there is no current window"
+ * XXX Desired 'freeglut' behaviour when there is no current window")
*/
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateWindow" );
- return fgCreateWindow( NULL, title, fgState.Position.Use,
- fgState.Position.X, fgState.Position.Y,
+ return fgCreateWindow( NULL, title,
+ fgState.Position.Use, fgState.Position.X, fgState.Position.Y,
fgState.Size.Use, fgState.Size.X, fgState.Size.Y,
GL_FALSE, GL_FALSE )->ID;
}
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateSubWindow" );
parent = fgWindowByID( parentID );
freeglut_return_val_if_fail( parent != NULL, 0 );
- if ( x < 0 )
- {
- x = parent->State.Width + x ;
- if ( w >= 0 ) x -= w ;
- }
- if ( w < 0 ) w = parent->State.Width - x + w ;
- if ( w < 0 )
+ if ( fgState.AllowNegativeWindowPosition )
{
- x += w ;
- w = -w ;
- }
+ /* XXX This results in different widths/heights than if AllowNegativeWindowPosition
+ * XXX was false. The "freeglut" community defined this logic.
+ * XXX (freeglut-developer e-mail from Diederick C. Niehorster, 11/15/2015, 4:06 PM EST.
+ * XXX "Re: [Freeglut-developer] glutInitWindowPosition with negative coordinate(s)")
+ */
- if ( y < 0 )
- {
- y = parent->State.Height + y ;
- if ( h >= 0 ) y -= h ;
+ if ( w < 0 ) w = parent->State.Width + w ;
+ if ( h < 0 ) h = parent->State.Height + h ;
}
-
- if ( h < 0 ) h = parent->State.Height - y + h ;
- if ( h < 0 )
+ else
{
- y += h ;
- h = -h ;
+ if ( ( x < 0 ) )
+ {
+ x = parent->State.Width + x ;
+ if ( w > 0 ) x -= w ;
+ }
+
+ if ( w < 0 ) w = parent->State.Width - x + w ;
+ if ( w < 0 )
+ {
+ x += w ;
+ w = -w ;
+ }
+
+ if ( ( y < 0 ) )
+ {
+ y = parent->State.Height + y ;
+ if ( h > 0 ) y -= h ;
+ }
+
+ if ( h < 0 ) h = parent->State.Height - y + h ;
+ if ( h < 0 )
+ {
+ y += h ;
+ h = -h ;
+ }
}
- window = fgCreateWindow( parent, "", GL_TRUE, x, y, GL_TRUE, w, h, GL_FALSE, GL_FALSE );
+ window = fgCreateWindow( parent, "",
+ GL_TRUE, x, y,
+ GL_TRUE, w, h,
+ GL_FALSE, GL_FALSE );
ret = window->ID;
return ret;