mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-26 01:04:17 +00:00
Use the convenience function SDL_GetWindowFromEvent()
This commit is contained in:
@@ -408,7 +408,7 @@ static void loop(void)
|
||||
break;
|
||||
case SDL_EVENT_FINGER_DOWN:
|
||||
{
|
||||
SDL_Window *window = SDL_GetWindowFromID(event.tfinger.windowID);
|
||||
SDL_Window *window = SDL_GetWindowFromEvent(&event);
|
||||
if (SDL_TextInputActive(window)) {
|
||||
SDL_Log("Stopping text input for window %" SDL_PRIu32 "\n", event.tfinger.windowID);
|
||||
SDL_StopTextInput(window);
|
||||
@@ -420,7 +420,7 @@ static void loop(void)
|
||||
}
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
if (event.button.button == SDL_BUTTON_RIGHT) {
|
||||
SDL_Window *window = SDL_GetWindowFromID(event.button.windowID);
|
||||
SDL_Window *window = SDL_GetWindowFromEvent(&event);
|
||||
if (SDL_TextInputActive(window)) {
|
||||
SDL_Log("Stopping text input for window %" SDL_PRIu32 "\n", event.button.windowID);
|
||||
SDL_StopTextInput(window);
|
||||
|
||||
@@ -167,7 +167,7 @@ static void loop(void)
|
||||
SDLTest_CommonEvent(state, &event, &done);
|
||||
|
||||
if (event.type == SDL_EVENT_WINDOW_RESIZED) {
|
||||
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
||||
SDL_Window *window = SDL_GetWindowFromEvent(&event);
|
||||
if (window) {
|
||||
SDL_Log("Window %" SDL_PRIu32 " resized to %" SDL_PRIs32 "x%" SDL_PRIs32 "\n",
|
||||
event.window.windowID,
|
||||
@@ -176,7 +176,7 @@ static void loop(void)
|
||||
}
|
||||
}
|
||||
if (event.type == SDL_EVENT_WINDOW_MOVED) {
|
||||
SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
|
||||
SDL_Window *window = SDL_GetWindowFromEvent(&event);
|
||||
if (window) {
|
||||
SDL_Log("Window %" SDL_PRIu32 " moved to %" SDL_PRIs32 ",%" SDL_PRIs32 " (display %s)\n",
|
||||
event.window.windowID,
|
||||
|
||||
Reference in New Issue
Block a user