Commit b5e5c1ef482d8c4aab768ff66616c877d61d7593

Sam Lantinga 2021-08-13T17:53:39

Added Ctrl-T to toggle topmost mode in test programs

diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 5fea48f..69eaa71 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -2019,6 +2019,20 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
                 SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode() ? SDL_TRUE : SDL_FALSE);
             }
             break;
+        case SDLK_t:
+            if (withControl) {
+                /* Ctrl-T toggle topmost mode */
+                SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
+                if (window) {
+                    Uint32 flags = SDL_GetWindowFlags(window);
+                    if (flags & SDL_WINDOW_ALWAYS_ON_TOP) {
+                        SDL_SetWindowAlwaysOnTop(window, SDL_FALSE);
+                    } else {
+                        SDL_SetWindowAlwaysOnTop(window, SDL_TRUE);
+                    }
+                }
+            }
+            break;
         case SDLK_z:
             if (withControl) {
                 /* Ctrl-Z minimize */