* Indentation issues.
[freeglut] / src / freeglut_internal.h
index 4564157..9e80935 100644 (file)
@@ -89,7 +89,7 @@
     #include <X11/Xatom.h>
     #include <X11/keysym.h>
 
-    #ifndef __sgi
+    #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
     #include <X11/extensions/xf86vmode.h>
     #endif
 #endif
@@ -120,6 +120,7 @@ typedef void (* FGCBvisibility    )( int );
 typedef void (* FGCBkeyboard      )( unsigned char, int, int );
 typedef void (* FGCBspecial       )( int, int, int );
 typedef void (* FGCBmouse         )( int, int, int, int );
+typedef void (* FGCBmousewheel    )( int, int, int, int );
 typedef void (* FGCBmotion        )( int, int );
 typedef void (* FGCBpassive       )( int, int );
 typedef void (* FGCBentry         )( int );
@@ -235,6 +236,8 @@ struct tagSFG_State
 
     FGCBidle         IdleCallback;         /* The global idle callback          */
 
+    GLboolean        BuildingAMenu;        /* True if we are presently making a menu */
+    int              ActiveMenus;          /* Number of currently active menus  */
     FGCBmenuState    MenuStateCallback;    /* Menu callbacks are global         */
     FGCBmenuStatus   MenuStatusCallback;
 
@@ -245,6 +248,7 @@ struct tagSFG_State
     int              ActionOnWindowClose ; /* Action when user clicks "x" on window header bar */
 
     fgExecutionState ExecState ;           /* Current state of the GLUT execution */
+    char            *ProgramName ;         /* Name of the program invoking the "freeglut" library" */
 };
 
 /*
@@ -268,6 +272,11 @@ struct tagSFG_Display
     int             DisplayModeValid;   /* Flag that indicates runtime status*/
     XF86VidModeModeLine DisplayMode;    /* Current screen's display settings */
     int             DisplayModeClock;   /* The display mode's refresh rate   */
+    int             DisplayViewPortX;   /* saved X location of the viewport  */
+    int             DisplayViewPortY;   /* saved Y location of the viewport  */
+    int             DisplayPointerX;    /* saved X location of the pointer   */
+    int             DisplayPointerY;    /* saved Y location of the pointer   */
+
 #endif
 
 #elif TARGET_HOST_WIN32
@@ -361,6 +370,7 @@ struct tagSFG_WindowCallbacks
     FGCBspecial         Special;
     FGCBspecialUp       SpecialUp;
     FGCBmouse           Mouse;
+    FGCBmousewheel      MouseWheel;
     FGCBmotion          Motion;
     FGCBpassive         Passive;
     FGCBentry           Entry;
@@ -384,8 +394,25 @@ struct tagSFG_WindowCallbacks
 };
 
 /*
+ * This structure holds the OpenGL rendering context for all the menu windows
+ */
+typedef struct tagSFG_MenuContext SFG_MenuContext;
+struct tagSFG_MenuContext
+{
+#if TARGET_HOST_UNIX_X11
+    GLXContext          Context;                /* The menu OpenGL context   */
+    XVisualInfo*        VisualInfo;             /* The window's visual information */
+#elif TARGET_HOST_WIN32
+    HGLRC               Context;                /* The menu window's WGL context    */
+#endif
+
+};
+
+/*
  * This structure describes a menu
  */
+typedef struct tagSFG_Window SFG_Window;
+typedef struct tagSFG_MenuEntry SFG_MenuEntry;
 typedef struct tagSFG_Menu SFG_Menu;
 struct tagSFG_Menu
 {
@@ -399,12 +426,15 @@ struct tagSFG_Menu
     int                 Width;                  /* Menu box width in pixels  */
     int                 Height;                 /* Menu box height in pixels */
     int                 X, Y;                   /* Menu box raster position  */
+
+    SFG_MenuEntry      *ActiveEntry ;           /* Currently active entry in the menu */
+    SFG_Window         *Window ;                /* OpenGL window for menu    */
+    SFG_Window         *ParentWindow ;          /* OpenGL window in which the menu is defined */
 };
 
 /*
  * This is a menu entry
  */
-typedef struct tagSFG_MenuEntry SFG_MenuEntry;
 struct tagSFG_MenuEntry
 {
     SFG_Node            Node;
@@ -419,7 +449,6 @@ struct tagSFG_MenuEntry
 /*
  * A window, making part of freeglut windows hierarchy. Should be kept portable.
  */
-typedef struct tagSFG_Window SFG_Window;
 struct tagSFG_Window
 {
     SFG_Node            Node;
@@ -435,6 +464,8 @@ struct tagSFG_Window
 
     SFG_Window*         Parent;                 /* The parent to this window */
     SFG_List            Children;               /* The subwindows d.l. list  */
+
+    GLboolean           IsMenu;                 /* Set to 1 if we are a menu */
 };
 
 /*
@@ -460,6 +491,8 @@ struct tagSFG_Structure
     SFG_Window*         Window;                 /* The currently active win. */
     SFG_Menu*           Menu;                   /* Same, but menu...         */
 
+    SFG_MenuContext*    MenuContext;            /* OpenGL rendering context for menus */
+
     SFG_Window*         GameMode;               /* The game mode window      */
 
     int                 WindowID;               /* The new current window ID */
@@ -673,6 +706,7 @@ void fgActivateMenu( SFG_Window* window, int button );
 void fgExecuteMenuCallback( SFG_Menu* menu ) ;
 GLboolean fgCheckActiveMenu ( SFG_Window *window, SFG_Menu *menu ) ;
 void fgDeactivateMenu( SFG_Window *window );
+void fgDeactivateSubMenu( SFG_MenuEntry *menuEntry );
 
 /*
  * This function gets called just before the buffers swap, so that