Commit 86517d3eda559beee2ca7438435b08b6c2cac442

Sam Lantinga 2020-08-10T08:42:35

Fixed bug 5242 - KMOD_* flags unnecessarily macros; breaks OGRE Rainer Deyke While most of the KMOD_* flags are enums, the combination flags KMOD_CTRL, KMOD_ALT, KMOD_SHIFT and KMOD_GUI are defined as macros. This breaks third-party code that uses these KMOD_* names for local identifiers, such as OGRE. The correct thing to do is to make them all enums.

diff --git a/include/SDL_keycode.h b/include/SDL_keycode.h
index a1ce7a4..c1c1316 100644
--- a/include/SDL_keycode.h
+++ b/include/SDL_keycode.h
@@ -336,13 +336,13 @@ typedef enum
     KMOD_NUM = 0x1000,
     KMOD_CAPS = 0x2000,
     KMOD_MODE = 0x4000,
-    KMOD_RESERVED = 0x8000
-} SDL_Keymod;
+    KMOD_RESERVED = 0x8000,
 
-#define KMOD_CTRL   (KMOD_LCTRL|KMOD_RCTRL)
-#define KMOD_SHIFT  (KMOD_LSHIFT|KMOD_RSHIFT)
-#define KMOD_ALT    (KMOD_LALT|KMOD_RALT)
-#define KMOD_GUI    (KMOD_LGUI|KMOD_RGUI)
+    KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
+    KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
+    KMOD_ALT = KMOD_LALT | KMOD_RALT,
+    KMOD_GUI = KMOD_LGUI | KMOD_RGUI,
+} SDL_Keymod;
 
 #endif /* SDL_keycode_h_ */