SDL: wikiheaders: Defines directly following a non-struct typedef are documented.

From 2fb024ab8e4c457c612bf41d07380464948efd97 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 25 Apr 2024 02:58:53 -0400
Subject: [PATCH] wikiheaders: Defines directly following a non-struct typedef
 are documented.

The idea is that if you have a `typedef Uint32 MyFlags` that has a bunch of
defines that are meant to be bitflags, you can pack them into the same wiki
page automatically.

This only works with `typedef`s that are _not_ struct/union/enums, and it
only pulls in `#define` lines that immediately follow the typedef line.
Even a blank line or a comment will signal to stop including lines for
this page!
---
 build-scripts/wikiheaders.pl | 15 +++++++++++++++
 include/SDL3/SDL_keycode.h   |  5 -----
 include/SDL3/SDL_video.h     |  1 -
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index b81025e5674d8..6de0518d168db 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -858,6 +858,21 @@ sub print_undocumented_section {
                 }
                 next;
             }
+
+            # We assume any `#define`s directly after the typedef are related to it: probably bitflags for an integer typedef. Even a blank line will signify an end!
+            my $lastpos = tell(FH);
+            my $additional_decl = '';
+            while (<FH>) {
+                chomp;
+                if (not /\A\s*\#define\s+/) {
+                    seek(FH, $lastpos, 0);  # re-read this line again next time.
+                    last;
+                }
+                $additional_decl .= "$_\n";
+                push @decllines, $_;
+                $lastpos = tell(FH);
+            }
+            $decl .= "\n$additional_decl" if ($additional_decl ne '');
         } else {
             die("Unexpected symtype $symtype");
         }
diff --git a/include/SDL3/SDL_keycode.h b/include/SDL3/SDL_keycode.h
index 0dbd0a051bd1b..a4461903e0030 100644
--- a/include/SDL3/SDL_keycode.h
+++ b/include/SDL3/SDL_keycode.h
@@ -47,13 +47,8 @@
  * \sa SDL_KeyCode
  */
 typedef Sint32 SDL_Keycode;
-
 #define SDLK_SCANCODE_MASK (1<<30)
 #define SDL_SCANCODE_TO_KEYCODE(X)  (X | SDLK_SCANCODE_MASK)
-
-/**
- * A subset of possible virtual key values.
- */
 #define SDLK_UNKNOWN    0
 #define SDLK_RETURN '\r'
 #define SDLK_ESCAPE '\x1B'
diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h
index f5e8d8e725373..e47da978ba683 100644
--- a/include/SDL3/SDL_video.h
+++ b/include/SDL3/SDL_video.h
@@ -131,7 +131,6 @@ typedef struct SDL_Window SDL_Window;
  * \sa SDL_GetWindowFlags
  */
 typedef Uint32 SDL_WindowFlags;
-
 #define SDL_WINDOW_FULLSCREEN           0x00000001U /**< window is in fullscreen mode */
 #define SDL_WINDOW_OPENGL               0x00000002U /**< window usable with OpenGL context */
 #define SDL_WINDOW_OCCLUDED             0x00000004U /**< window is occluded */