mirror of https://github.com/libsdl-org/SDL
Rename mouse BUTTON(DOWN|UP) event to BUTTON_(DOWN|UP)
This commit is contained in:
parent
413376cdb3
commit
758c0dd6d8
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <frames per second>]",
|
||||
"[--nodelay]",
|
||||
"[--yuvformat <fmt>] (one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)",
|
||||
"[--yuvformat <fmt>] (one of the: YV12 (default), IYUV, YUY2, UYVY, YVYU, NV12, NV21)",
|
||||
"[--scale <scale factor>] (initial scale of the overlay)",
|
||||
"[--nostreaming] path that use SDL_CreateTextureFromSurface() not STREAMING texture",
|
||||
NULL
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue