mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-14 13:56:00 +00:00
Rename SDL_BUTTON() to SDL_BUTTON_MASK()
Fixes https://github.com/libsdl-org/SDL/issues/11056
This commit is contained in:
@@ -485,7 +485,7 @@ void SDL_ResetMouse(void)
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= sizeof(buttonState)*8; ++i) {
|
||||
if (buttonState & SDL_BUTTON(i)) {
|
||||
if (buttonState & SDL_BUTTON_MASK(i)) {
|
||||
SDL_SendMouseButton(0, mouse->focus, mouse->mouseID, i, false);
|
||||
}
|
||||
}
|
||||
@@ -876,13 +876,13 @@ static SDL_MouseInputSource *GetMouseInputSource(SDL_Mouse *mouse, SDL_MouseID m
|
||||
}
|
||||
}
|
||||
|
||||
if (!down && (!match || !(match->buttonstate & SDL_BUTTON(button)))) {
|
||||
if (!down && (!match || !(match->buttonstate & SDL_BUTTON_MASK(button)))) {
|
||||
/* This might be a button release from a transition between mouse messages and raw input.
|
||||
* See if there's another mouse source that already has that button down and use that.
|
||||
*/
|
||||
for (i = 0; i < mouse->num_sources; ++i) {
|
||||
source = &mouse->sources[i];
|
||||
if ((source->buttonstate & SDL_BUTTON(button))) {
|
||||
if ((source->buttonstate & SDL_BUTTON_MASK(button))) {
|
||||
match = source;
|
||||
break;
|
||||
}
|
||||
@@ -966,10 +966,10 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL
|
||||
// Figure out which event to perform
|
||||
if (down) {
|
||||
type = SDL_EVENT_MOUSE_BUTTON_DOWN;
|
||||
buttonstate |= SDL_BUTTON(button);
|
||||
buttonstate |= SDL_BUTTON_MASK(button);
|
||||
} else {
|
||||
type = SDL_EVENT_MOUSE_BUTTON_UP;
|
||||
buttonstate &= ~SDL_BUTTON(button);
|
||||
buttonstate &= ~SDL_BUTTON_MASK(button);
|
||||
}
|
||||
|
||||
// We do this after calculating buttonstate so button presses gain focus
|
||||
|
@@ -1018,12 +1018,12 @@ static void SDLTest_PrintButtonMask(char *text, size_t maxlen, SDL_MouseButtonFl
|
||||
int i;
|
||||
int count = 0;
|
||||
for (i = 1; i <= 32; ++i) {
|
||||
const Uint32 flag = SDL_BUTTON(i);
|
||||
const Uint32 flag = SDL_BUTTON_MASK(i);
|
||||
if ((flags & flag) == flag) {
|
||||
if (count > 0) {
|
||||
SDL_snprintfcat(text, maxlen, " | ");
|
||||
}
|
||||
SDL_snprintfcat(text, maxlen, "SDL_BUTTON(%d)", i);
|
||||
SDL_snprintfcat(text, maxlen, "SDL_BUTTON_MASK(%d)", i);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
@@ -238,7 +238,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= MAX_MOUSE_BUTTONS; ++i) {
|
||||
if (event.buttonMask & SDL_BUTTON(i)) {
|
||||
if (event.buttonMask & SDL_BUTTON_MASK(i)) {
|
||||
Uint8 button;
|
||||
|
||||
switch (i) {
|
||||
@@ -294,7 +294,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= MAX_MOUSE_BUTTONS; ++i) {
|
||||
if (event.buttonMask & SDL_BUTTON(i)) {
|
||||
if (event.buttonMask & SDL_BUTTON_MASK(i)) {
|
||||
Uint8 button;
|
||||
|
||||
switch (i) {
|
||||
|
@@ -740,9 +740,9 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_
|
||||
* long as any button is still down, the capture remains).
|
||||
*/
|
||||
if (state) { // update our mask of currently-pressed buttons
|
||||
input->buttons_pressed |= SDL_BUTTON(sdl_button);
|
||||
input->buttons_pressed |= SDL_BUTTON_MASK(sdl_button);
|
||||
} else {
|
||||
input->buttons_pressed &= ~(SDL_BUTTON(sdl_button));
|
||||
input->buttons_pressed &= ~(SDL_BUTTON_MASK(sdl_button));
|
||||
}
|
||||
|
||||
// Don't modify the capture flag in relative mode.
|
||||
|
@@ -220,10 +220,10 @@ static void WIN_CheckWParamMouseButton(Uint64 timestamp, bool bwParamMousePresse
|
||||
}
|
||||
}
|
||||
|
||||
if (data->focus_click_pending & SDL_BUTTON(button)) {
|
||||
if (data->focus_click_pending & SDL_BUTTON_MASK(button)) {
|
||||
// Ignore the button click for activation
|
||||
if (!bwParamMousePressed) {
|
||||
data->focus_click_pending &= ~SDL_BUTTON(button);
|
||||
data->focus_click_pending &= ~SDL_BUTTON_MASK(button);
|
||||
WIN_UpdateClipCursor(data->window);
|
||||
}
|
||||
if (WIN_ShouldIgnoreFocusClick(data)) {
|
||||
@@ -231,9 +231,9 @@ static void WIN_CheckWParamMouseButton(Uint64 timestamp, bool bwParamMousePresse
|
||||
}
|
||||
}
|
||||
|
||||
if (bwParamMousePressed && !(mouseFlags & SDL_BUTTON(button))) {
|
||||
if (bwParamMousePressed && !(mouseFlags & SDL_BUTTON_MASK(button))) {
|
||||
SDL_SendMouseButton(timestamp, data->window, mouseID, button, true);
|
||||
} else if (!bwParamMousePressed && (mouseFlags & SDL_BUTTON(button))) {
|
||||
} else if (!bwParamMousePressed && (mouseFlags & SDL_BUTTON_MASK(button))) {
|
||||
SDL_SendMouseButton(timestamp, data->window, mouseID, button, false);
|
||||
}
|
||||
}
|
||||
@@ -651,10 +651,10 @@ static void WIN_HandleRawMouseInput(Uint64 timestamp, SDL_VideoData *data, HANDL
|
||||
}
|
||||
}
|
||||
|
||||
if (windowdata->focus_click_pending & SDL_BUTTON(button)) {
|
||||
if (windowdata->focus_click_pending & SDL_BUTTON_MASK(button)) {
|
||||
// Ignore the button click for activation
|
||||
if (!down) {
|
||||
windowdata->focus_click_pending &= ~SDL_BUTTON(button);
|
||||
windowdata->focus_click_pending &= ~SDL_BUTTON_MASK(button);
|
||||
WIN_UpdateClipCursor(window);
|
||||
}
|
||||
if (WIN_ShouldIgnoreFocusClick(windowdata)) {
|
||||
|
Reference in New Issue
Block a user