From 0fcff8c3ccf56e112c0da95e48c3102f87e9f4bb Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Mon, 7 Mar 2022 05:57:37 +0000 Subject: [PATCH] Added GLUT_ACTIVE_SUPER modifier, and corresponding GLUT_KEY_SUPER_L and 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 | 7 +++++++ src/x11/fg_main_x11.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/GL/freeglut_ext.h b/include/GL/freeglut_ext.h index 932a16b..32bdcf3 100644 --- a/include/GL/freeglut_ext.h +++ b/include/GL/freeglut_ext.h @@ -44,6 +44,13 @@ #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 diff --git a/src/x11/fg_main_x11.c b/src/x11/fg_main_x11.c index e3e2a22..740ed0b 100644 --- a/src/x11/fg_main_x11.c +++ b/src/x11/fg_main_x11.c @@ -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; } /* -- 1.7.10.4