forked from Green-Sky/tomato
Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'
This commit is contained in:
23
external/sdl/SDL/test/testwm.c
vendored
23
external/sdl/SDL/test/testwm.c
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -34,7 +34,17 @@ static const char *cursorNames[] = {
|
||||
"sizeALL",
|
||||
"NO",
|
||||
"hand",
|
||||
"window top left",
|
||||
"window top",
|
||||
"window top right",
|
||||
"window right",
|
||||
"window bottom right",
|
||||
"window bottom",
|
||||
"window bottom left",
|
||||
"window left"
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(cursorNames, SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
|
||||
|
||||
static int system_cursor = -1;
|
||||
static SDL_Cursor *cursor = NULL;
|
||||
static SDL_bool relative_mode = SDL_FALSE;
|
||||
@ -205,7 +215,7 @@ static void loop(void)
|
||||
}
|
||||
if (event.type == SDL_EVENT_MOUSE_BUTTON_UP) {
|
||||
SDL_Window *window = SDL_GetMouseFocus();
|
||||
if (highlighted_mode != NULL && window != NULL) {
|
||||
if (highlighted_mode && window) {
|
||||
SDL_memcpy(&state->fullscreen_mode, highlighted_mode, sizeof(state->fullscreen_mode));
|
||||
SDL_SetWindowFullscreenMode(window, highlighted_mode);
|
||||
}
|
||||
@ -215,7 +225,7 @@ static void loop(void)
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
SDL_Window *window = state->windows[i];
|
||||
SDL_Renderer *renderer = state->renderers[i];
|
||||
if (window != NULL && renderer != NULL) {
|
||||
if (window && renderer) {
|
||||
float y = 0.0f;
|
||||
SDL_Rect viewport;
|
||||
SDL_FRect menurect;
|
||||
@ -251,23 +261,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (state == NULL) {
|
||||
if (!state) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
|
||||
SDL_assert(SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
|
||||
|
||||
if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) {
|
||||
SDLTest_CommonQuit(state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_TRUE);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, SDL_TRUE);
|
||||
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
SDL_Renderer *renderer = state->renderers[i];
|
||||
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
|
||||
|
Reference in New Issue
Block a user