Added Ctrl-T to toggle topmost mode in test programs

This commit is contained in:
Sam Lantinga 2021-08-13 17:53:39 -07:00
parent 4d9efcb55c
commit b5e5c1ef48

View file

@ -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 */