Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Reverted mousewheel support in 1.2, since it breaks binary compatibil…
Browse files Browse the repository at this point in the history
…ity.
  • Loading branch information
slouken committed Jul 6, 2007
1 parent 0b869de commit 3f78c77
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 32 deletions.
2 changes: 0 additions & 2 deletions include/SDL_compat.h
Expand Up @@ -63,8 +63,6 @@ extern "C" {

#define SDL_BUTTON_WHEELUP 4
#define SDL_BUTTON_WHEELDOWN 5
#define SDL_BUTTON_WHEELLEFT 6
#define SDL_BUTTON_WHEELRIGHT 7

#define SDL_DEFAULT_REPEAT_DELAY 500
#define SDL_DEFAULT_REPEAT_INTERVAL 30
Expand Down
47 changes: 17 additions & 30 deletions src/SDL_compat.c
Expand Up @@ -252,46 +252,33 @@ SDL_CompatEventFilter(void *userdata, SDL_Event * event)
int selected;
int x, y;

if (event->wheel.y == 0) {
break;
}

selected = SDL_SelectMouse(event->wheel.which);
SDL_GetMouseState(&x, &y);
SDL_SelectMouse(selected);

if (event->wheel.y > 0) {
button = SDL_BUTTON_WHEELUP;
} else {
button = SDL_BUTTON_WHEELDOWN;
}

fake.button.which = event->wheel.windowID;
fake.button.button = button;
fake.button.x = x;
fake.button.y = y;
fake.button.windowID = event->wheel.windowID;

if (event->wheel.y) {
if (event->wheel.y > 0) {
fake.button.button = SDL_BUTTON_WHEELUP;
} else {
fake.button.button = SDL_BUTTON_WHEELDOWN;
}

fake.type = SDL_MOUSEBUTTONDOWN;
fake.button.state = SDL_PRESSED;
SDL_PushEvent(&fake);

fake.type = SDL_MOUSEBUTTONUP;
fake.button.state = SDL_RELEASED;
SDL_PushEvent(&fake);
}
if (event->wheel.x) {
if (event->wheel.y > 0) {
fake.button.button = SDL_BUTTON_WHEELLEFT;
} else {
fake.button.button = SDL_BUTTON_WHEELRIGHT;
}

fake.type = SDL_MOUSEBUTTONDOWN;
fake.button.state = SDL_PRESSED;
SDL_PushEvent(&fake);

fake.type = SDL_MOUSEBUTTONUP;
fake.button.state = SDL_RELEASED;
SDL_PushEvent(&fake);
}
fake.type = SDL_MOUSEBUTTONDOWN;
fake.button.state = SDL_PRESSED;
SDL_PushEvent(&fake);

fake.type = SDL_MOUSEBUTTONUP;
fake.button.state = SDL_RELEASED;
SDL_PushEvent(&fake);
break;
}

Expand Down

0 comments on commit 3f78c77

Please sign in to comment.