diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 10546ba915..9d22580de9 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -2180,11 +2180,11 @@ expression e; @@ @@ - SDL_MOUSEBUTTONDOWN -+ SDL_EVENT_MOUSE_BUTTONDOWN ++ SDL_EVENT_MOUSE_BUTTON_DOWN @@ @@ - SDL_MOUSEBUTTONUP -+ SDL_EVENT_MOUSE_BUTTONUP ++ SDL_EVENT_MOUSE_BUTTON_UP @@ @@ - SDL_MOUSEWHEEL diff --git a/docs/README-migration.md b/docs/README-migration.md index 5b38038ad1..4b0ee7e2f4 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -170,8 +170,8 @@ The following symbols have been renamed: * SDL_KEYUP => SDL_EVENT_KEY_UP * SDL_LASTEVENT => SDL_EVENT_LAST * SDL_LOCALECHANGED => SDL_EVENT_LOCALECHANGED -* SDL_MOUSEBUTTONDOWN => SDL_EVENT_MOUSE_BUTTONDOWN -* SDL_MOUSEBUTTONUP => SDL_EVENT_MOUSE_BUTTONUP +* SDL_MOUSEBUTTONDOWN => SDL_EVENT_MOUSE_BUTTON_DOWN +* SDL_MOUSEBUTTONUP => SDL_EVENT_MOUSE_BUTTON_UP * SDL_MOUSEMOTION => SDL_EVENT_MOUSE_MOTION * SDL_MOUSEWHEEL => SDL_EVENT_MOUSE_WHEEL * SDL_POLLSENTINEL => SDL_EVENT_POLL_SENTINEL diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index ff50789013..89bfaceda3 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -133,8 +133,8 @@ typedef enum /* Mouse events */ SDL_EVENT_MOUSE_MOTION = 0x400, /**< Mouse moved */ - SDL_EVENT_MOUSE_BUTTONDOWN, /**< Mouse button pressed */ - SDL_EVENT_MOUSE_BUTTONUP, /**< Mouse button released */ + SDL_EVENT_MOUSE_BUTTON_DOWN, /**< Mouse button pressed */ + SDL_EVENT_MOUSE_BUTTON_UP, /**< Mouse button released */ SDL_EVENT_MOUSE_WHEEL, /**< Mouse wheel motion */ /* Joystick events */ @@ -307,7 +307,7 @@ typedef struct SDL_MouseMotionEvent */ typedef struct SDL_MouseButtonEvent { - Uint32 type; /**< ::SDL_EVENT_MOUSE_BUTTONDOWN or ::SDL_EVENT_MOUSE_BUTTONUP */ + Uint32 type; /**< ::SDL_EVENT_MOUSE_BUTTON_DOWN or ::SDL_EVENT_MOUSE_BUTTON_UP */ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_WindowID windowID;/**< The window with mouse focus, if any */ SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index ef033e3a87..23fb15632c 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -98,8 +98,8 @@ #define SDL_KEYUP SDL_EVENT_KEY_UP #define SDL_LASTEVENT SDL_EVENT_LAST #define SDL_LOCALECHANGED SDL_EVENT_LOCALE_CHANGED -#define SDL_MOUSEBUTTONDOWN SDL_EVENT_MOUSE_BUTTONDOWN -#define SDL_MOUSEBUTTONUP SDL_EVENT_MOUSE_BUTTONUP +#define SDL_MOUSEBUTTONDOWN SDL_EVENT_MOUSE_BUTTON_DOWN +#define SDL_MOUSEBUTTONUP SDL_EVENT_MOUSE_BUTTON_UP #define SDL_MOUSEMOTION SDL_EVENT_MOUSE_MOTION #define SDL_MOUSEWHEEL SDL_EVENT_MOUSE_WHEEL #define SDL_POLLSENTINEL SDL_EVENT_POLL_SENTINEL @@ -479,8 +479,8 @@ #define SDL_KEYUP SDL_KEYUP_renamed_SDL_EVENT_KEY_UP #define SDL_LASTEVENT SDL_LASTEVENT_renamed_SDL_EVENT_LAST #define SDL_LOCALECHANGED SDL_LOCALECHANGED_renamed_SDL_EVENT_LOCALECHANGED -#define SDL_MOUSEBUTTONDOWN SDL_MOUSEBUTTONDOWN_renamed_SDL_EVENT_MOUSE_BUTTONDOWN -#define SDL_MOUSEBUTTONUP SDL_MOUSEBUTTONUP_renamed_SDL_EVENT_MOUSE_BUTTONUP +#define SDL_MOUSEBUTTONDOWN SDL_MOUSEBUTTONDOWN_renamed_SDL_EVENT_MOUSE_BUTTON_DOWN +#define SDL_MOUSEBUTTONUP SDL_MOUSEBUTTONUP_renamed_SDL_EVENT_MOUSE_BUTTON_UP #define SDL_MOUSEMOTION SDL_MOUSEMOTION_renamed_SDL_EVENT_MOUSE_MOTION #define SDL_MOUSEWHEEL SDL_MOUSEWHEEL_renamed_SDL_EVENT_MOUSE_WHEEL #define SDL_POLLSENTINEL SDL_POLLSENTINEL_renamed_SDL_EVENT_POLL_SENTINEL diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 74b332599d..d863ee5c29 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -296,10 +296,10 @@ static void SDL_LogEvent(const SDL_Event *event) (uint)event->button.which, (uint)event->button.button, \ event->button.state == SDL_PRESSED ? "pressed" : "released", \ (uint)event->button.clicks, event->button.x, event->button.y) - SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTONDOWN) + SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTON_DOWN) PRINT_MBUTTON_EVENT(event); break; - SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTONUP) + SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTON_UP) PRINT_MBUTTON_EVENT(event); break; #undef PRINT_MBUTTON_EVENT diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 5944b57434..d0418f847a 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -687,11 +687,11 @@ static int SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_ /* Figure out which event to perform */ switch (state) { case SDL_PRESSED: - type = SDL_EVENT_MOUSE_BUTTONDOWN; + type = SDL_EVENT_MOUSE_BUTTON_DOWN; buttonstate |= SDL_BUTTON(button); break; case SDL_RELEASED: - type = SDL_EVENT_MOUSE_BUTTONUP; + type = SDL_EVENT_MOUSE_BUTTON_UP; buttonstate &= ~SDL_BUTTON(button); break; default: diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index c891f20f2e..a6a8de0933 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -772,8 +772,8 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) } } } - } else if (event->type == SDL_EVENT_MOUSE_BUTTONDOWN || - event->type == SDL_EVENT_MOUSE_BUTTONUP) { + } else if (event->type == SDL_EVENT_MOUSE_BUTTON_DOWN || + event->type == SDL_EVENT_MOUSE_BUTTON_UP) { SDL_Window *window = SDL_GetWindowFromID(event->button.windowID); if (window == renderer->window) { int logical_w, logical_h; diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 8a56e3d7ad..9163f6141e 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1526,12 +1526,12 @@ static void SDLTest_PrintEvent(SDL_Event *event) event->motion.xrel, event->motion.yrel, event->motion.windowID); break; - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: SDL_Log("SDL EVENT: Mouse: button %d pressed at %g,%g with click count %d in window %" SDL_PRIu32, event->button.button, event->button.x, event->button.y, event->button.clicks, event->button.windowID); break; - case SDL_EVENT_MOUSE_BUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: SDL_Log("SDL EVENT: Mouse: button %d released at %g,%g with click count %d in window %" SDL_PRIu32, event->button.button, event->button.x, event->button.y, event->button.clicks, event->button.windowID); diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index fe64bca128..5db97b7ff9 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -658,10 +658,10 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse emscripten_request_pointerlock(window_data->canvas_id, 0); /* try to regrab lost pointer lock. */ } sdl_button_state = SDL_PRESSED; - sdl_event_type = SDL_EVENT_MOUSE_BUTTONDOWN; + sdl_event_type = SDL_EVENT_MOUSE_BUTTON_DOWN; } else { sdl_button_state = SDL_RELEASED; - sdl_event_type = SDL_EVENT_MOUSE_BUTTONUP; + sdl_event_type = SDL_EVENT_MOUSE_BUTTON_UP; } SDL_SendMouseButton(0, window_data->window, 0, sdl_button_state, sdl_button); diff --git a/test/checkkeys.c b/test/checkkeys.c index 117ffaef8c..74bc59960d 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -209,7 +209,7 @@ void loop() SDL_StartTextInput(); } break; - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: /* Left button quits the app, other buttons toggles text input */ if (event.button.button == SDL_BUTTON_LEFT) { done = 1; diff --git a/test/checkkeysthreads.c b/test/checkkeysthreads.c index fa6c6416e9..6cc060f904 100644 --- a/test/checkkeysthreads.c +++ b/test/checkkeysthreads.c @@ -184,7 +184,7 @@ void loop() case SDL_EVENT_TEXT_INPUT: PrintText("INPUT", event.text.text); break; - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: /* Left button quits the app, other buttons toggles text input */ (void)fprintf(stderr, "mouse button down button: %d (LEFT=%d)\n", event.button.button, SDL_BUTTON_LEFT); (void)fflush(stderr); diff --git a/test/gamepadmap.c b/test/gamepadmap.c index 8e90b16d96..c574196343 100644 --- a/test/gamepadmap.c +++ b/test/gamepadmap.c @@ -516,7 +516,7 @@ WatchJoystick(SDL_Joystick *joystick) } break; case SDL_EVENT_FINGER_DOWN: - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: /* Skip this step */ SetCurrentBinding(s_iCurrentBinding + 1); break; diff --git a/test/testaudiocapture.c b/test/testaudiocapture.c index 953f3aad83..82898153b4 100644 --- a/test/testaudiocapture.c +++ b/test/testaudiocapture.c @@ -38,12 +38,12 @@ loop() if (e.key.keysym.sym == SDLK_ESCAPE) { please_quit = SDL_TRUE; } - } else if (e.type == SDL_EVENT_MOUSE_BUTTONDOWN) { + } else if (e.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { if (e.button.button == 1) { SDL_PauseAudioDevice(devid_out); SDL_PlayAudioDevice(devid_in); } - } else if (e.type == SDL_EVENT_MOUSE_BUTTONUP) { + } else if (e.type == SDL_EVENT_MOUSE_BUTTON_UP) { if (e.button.button == 1) { SDL_PauseAudioDevice(devid_in); SDL_PlayAudioDevice(devid_out); diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c index b5398913a6..467c5fbe10 100644 --- a/test/testcustomcursor.c +++ b/test/testcustomcursor.c @@ -154,7 +154,7 @@ void loop() /* Check for events */ while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); - if (event.type == SDL_EVENT_MOUSE_BUTTONDOWN) { + if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { if (event.button.button == SDL_BUTTON_LEFT) { if (num_cursors == 0) { continue; diff --git a/test/testgamepad.c b/test/testgamepad.c index 5545df9477..8182539bc1 100644 --- a/test/testgamepad.c +++ b/test/testgamepad.c @@ -627,13 +627,13 @@ void loop(void *arg) SDL_Log("Gamepad %" SDL_PRIu32 " battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]); break; - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: if (virtual_joystick) { VirtualGamepadMouseDown(event.button.x, event.button.y); } break; - case SDL_EVENT_MOUSE_BUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: if (virtual_joystick) { VirtualGamepadMouseUp(event.button.x, event.button.y); } diff --git a/test/testhittesting.c b/test/testhittesting.c index c090f1140d..2974024a02 100644 --- a/test/testhittesting.c +++ b/test/testhittesting.c @@ -104,11 +104,11 @@ int main(int argc, char **argv) nothing_to_do = 0; switch (e.type) { - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: SDL_Log("button down!\n"); break; - case SDL_EVENT_MOUSE_BUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: SDL_Log("button up!\n"); break; diff --git a/test/testintersections.c b/test/testintersections.c index 40e735b56a..2fa16bb3d9 100644 --- a/test/testintersections.c +++ b/test/testintersections.c @@ -217,11 +217,11 @@ void loop() while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); switch (event.type) { - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: mouse_begin_x = event.button.x; mouse_begin_y = event.button.y; break; - case SDL_EVENT_MOUSE_BUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: if (event.button.button == 3) { add_line(mouse_begin_x, mouse_begin_y, event.button.x, event.button.y); } diff --git a/test/testjoystick.c b/test/testjoystick.c index 7b10db7497..a12265dec8 100644 --- a/test/testjoystick.c +++ b/test/testjoystick.c @@ -198,7 +198,7 @@ void loop(void *arg) } SDL_FALLTHROUGH; case SDL_EVENT_FINGER_DOWN: - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: case SDL_EVENT_QUIT: done = SDL_TRUE; break; diff --git a/test/testmouse.c b/test/testmouse.c index 9f7cf55e58..a7f921716c 100644 --- a/test/testmouse.c +++ b/test/testmouse.c @@ -136,7 +136,7 @@ void loop(void *arg) active->y2 = event.motion.y; break; - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: if (active == NULL) { active = SDL_calloc(1, sizeof(*active)); active->x1 = active->x2 = event.button.x; @@ -170,7 +170,7 @@ void loop(void *arg) } break; - case SDL_EVENT_MOUSE_BUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: if (active == NULL) { break; } diff --git a/test/testoverlay.c b/test/testoverlay.c index fe2746ece8..39011934a0 100644 --- a/test/testoverlay.c +++ b/test/testoverlay.c @@ -167,7 +167,7 @@ quit(int rc) /* If rc is 0, just let main return normally rather than calling exit. * This allows testing of platforms where SDL_main is required and does meaningful cleanup. */ - + SDL_free(RawMooseData); for (i = 0; i < MOOSEFRAMES_COUNT; i++) { @@ -221,7 +221,7 @@ void loop() Uint64 now; int i; SDL_Event event; - + SDL_Renderer *renderer = state->renderers[0]; /* only 1 window */ /* Check for events */ @@ -236,7 +236,7 @@ void loop() displayrect.w = (float)window_w; displayrect.h = (float)window_h; break; - case SDL_EVENT_MOUSE_BUTTONDOWN: + case SDL_EVENT_MOUSE_BUTTON_DOWN: displayrect.x = event.button.x - window_w / 2; displayrect.y = event.button.y - window_h / 2; break; @@ -302,12 +302,12 @@ int main(int argc, char **argv) if (state == NULL) { return 1; } - + SDL_zeroa(MooseYUVSurfaces); for (i = 1; i < argc;) { int consumed; - + consumed = SDLTest_CommonArg(state, i); if (consumed == 0) { consumed = -1; @@ -383,7 +383,7 @@ int main(int argc, char **argv) static const char *options[] = { "[--fps ]", "[--nodelay]", - "[--yuvformat ] (one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)", + "[--yuvformat ] (one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)", "[--scale ] (initial scale of the overlay)", "[--nostreaming] path that use SDL_CreateTextureFromSurface() not STREAMING texture", NULL diff --git a/test/testsensor.c b/test/testsensor.c index cfb99ca885..f96522e7d6 100644 --- a/test/testsensor.c +++ b/test/testsensor.c @@ -106,7 +106,7 @@ int main(int argc, char **argv) case SDL_EVENT_SENSOR_UPDATE: HandleSensorEvent(&event.sensor); break; - case SDL_EVENT_MOUSE_BUTTONUP: + case SDL_EVENT_MOUSE_BUTTON_UP: case SDL_EVENT_KEY_UP: case SDL_EVENT_QUIT: done = SDL_TRUE; diff --git a/test/testwm.c b/test/testwm.c index a0d8fcdaa1..73c1e0667d 100644 --- a/test/testwm.c +++ b/test/testwm.c @@ -204,7 +204,7 @@ void loop() SDL_SetCursor(cursor); } } - if (event.type == SDL_EVENT_MOUSE_BUTTONUP) { + if (event.type == SDL_EVENT_MOUSE_BUTTON_UP) { SDL_Window *window = SDL_GetMouseFocus(); if (highlighted_mode != -1 && window != NULL) { const int display_index = SDL_GetWindowDisplayIndex(window); diff --git a/test/testyuv.c b/test/testyuv.c index 6b024f929c..f9622d74a1 100644 --- a/test/testyuv.c +++ b/test/testyuv.c @@ -411,7 +411,7 @@ int main(int argc, char **argv) ++current; } } - if (event.type == SDL_EVENT_MOUSE_BUTTONDOWN) { + if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { if (event.button.x < (original->w / 2)) { --current; } else {