Added GLUT_ACTIVE_SUPER modifier, and corresponding GLUT_KEY_SUPER_L and
authorJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 7 Mar 2022 05:57:37 +0000 (05:57 +0000)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 7 Mar 2022 05:57:37 +0000 (05:57 +0000)
GLUT_KEY_SUPER_R special keys. These should map to Windows and Command
keys on regular PC keyboards and apple keyboards respectively. Only
implemented on X11 for now.

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1875 7f0cb862-5218-0410-a997-914c9d46530a

include/GL/freeglut_ext.h
src/x11/fg_main_x11.c

index 932a16b..32bdcf3 100644 (file)
 #define GLUT_KEY_CTRL_R             0x0073
 #define GLUT_KEY_ALT_L              0x0074
 #define GLUT_KEY_ALT_R              0x0075
+#define GLUT_KEY_SUPER_L            0x0076
+#define GLUT_KEY_SUPER_R            0x0077
+
+/*
+ * Additional GLUT modifiers
+ */
+#define GLUT_ACTIVE_SUPER           0x0008
 
 /*
  * GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
index e3e2a22..740ed0b 100644 (file)
@@ -135,6 +135,8 @@ int fgPlatformGetModifiers( int state )
         ret |= GLUT_ACTIVE_CTRL;
     if( state & Mod1Mask )
         ret |= GLUT_ACTIVE_ALT;
+    if( state & Mod2Mask )
+        ret |= GLUT_ACTIVE_SUPER;
 
     return ret;
 }
@@ -1012,6 +1014,14 @@ void fgPlatformProcessSingleEvent ( void )
                     case XK_Control_R: special = GLUT_KEY_CTRL_R;     break;
                     case XK_Alt_L:     special = GLUT_KEY_ALT_L;      break;
                     case XK_Alt_R:     special = GLUT_KEY_ALT_R;      break;
+                    case XK_Meta_L:
+                    case XK_Super_L:
+                        special = GLUT_KEY_SUPER_L;
+                        break;
+                    case XK_Meta_R:
+                    case XK_Super_R:
+                        special = GLUT_KEY_SUPER_R;
+                        break;
                     }
 
                     /*