Added keyup events code.
[freeglut] / freeglut-1.3 / freeglut_window.c
index 6fdf638..943b027 100644 (file)
@@ -324,7 +324,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
      *       This might speed up message processing. Is that true?
      */
     winAttr.event_mask        = StructureNotifyMask | SubstructureNotifyMask | ExposureMask |
-                                ButtonPressMask | ButtonReleaseMask | KeyPressMask |
+                                ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyRelease |
                                 VisibilityChangeMask | EnterWindowMask | LeaveWindowMask |
                                 PointerMotionMask | ButtonMotionMask;
     winAttr.background_pixmap = None;
@@ -389,8 +389,8 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
      */
     sizeHints.flags = 0;
 
-    sizeHints.flags |= (fgState.Position.Use == TRUE) ? USPosition : PPosition;
-    sizeHints.flags |= (fgState.Size.Use     == TRUE) ? USSize     : PSize;
+    if (fgState.Position.Use == TRUE) sizeHints.flags |= USPosition;
+    if (fgState.Size.Use     == TRUE) sizeHints.flags |= USSize;
 
     /*
      * Fill in the size hints values now (the x, y, width and height
@@ -436,16 +436,16 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
     XMapWindow( fgDisplay.Display, window->Window.Handle );
 
     /*
-     * This somehow fixes the glutGet() GLUT_WINDOW_X and GLUT_WINDOW_Y problem...
-     */
-    XMoveWindow( fgDisplay.Display, window->Window.Handle, x, y );
-
-    /*
      * In game mode, move the viewport a bit to hide the decorations.
      * This code depends on the XFree86 video mode extensions.
      */
     if( gameMode == TRUE )
     {
+        /*
+         * This somehow fixes the glutGet() GLUT_WINDOW_X and GLUT_WINDOW_Y problem...
+         */
+        XMoveWindow( fgDisplay.Display, window->Window.Handle, x, y );
+
 #       ifdef X_XF86VidModeSetViewPort
 
         /*