Reverted mousewheel support in 1.2, since it breaks binary compatibility.
authorSam Lantinga <slouken@libsdl.org>
Fri, 06 Jul 2007 13:45:10 +0000
changeset 2153760c1bd2d625
parent 2152 003c1b5b07da
child 2154 5660f48b31f5
Reverted mousewheel support in 1.2, since it breaks binary compatibility.
include/SDL_compat.h
src/SDL_compat.c
     1.1 --- a/include/SDL_compat.h	Fri Jul 06 09:22:18 2007 +0000
     1.2 +++ b/include/SDL_compat.h	Fri Jul 06 13:45:10 2007 +0000
     1.3 @@ -63,8 +63,6 @@
     1.4  
     1.5  #define SDL_BUTTON_WHEELUP	4
     1.6  #define SDL_BUTTON_WHEELDOWN	5
     1.7 -#define SDL_BUTTON_WHEELLEFT	6
     1.8 -#define SDL_BUTTON_WHEELRIGHT	7
     1.9  
    1.10  #define SDL_DEFAULT_REPEAT_DELAY	500
    1.11  #define SDL_DEFAULT_REPEAT_INTERVAL	30
     2.1 --- a/src/SDL_compat.c	Fri Jul 06 09:22:18 2007 +0000
     2.2 +++ b/src/SDL_compat.c	Fri Jul 06 13:45:10 2007 +0000
     2.3 @@ -252,46 +252,33 @@
     2.4              int selected;
     2.5              int x, y;
     2.6  
     2.7 +            if (event->wheel.y == 0) {
     2.8 +                break;
     2.9 +            }
    2.10 +
    2.11              selected = SDL_SelectMouse(event->wheel.which);
    2.12              SDL_GetMouseState(&x, &y);
    2.13              SDL_SelectMouse(selected);
    2.14  
    2.15 +            if (event->wheel.y > 0) {
    2.16 +                button = SDL_BUTTON_WHEELUP;
    2.17 +            } else {
    2.18 +                button = SDL_BUTTON_WHEELDOWN;
    2.19 +            }
    2.20 +
    2.21              fake.button.which = event->wheel.windowID;
    2.22 +            fake.button.button = button;
    2.23              fake.button.x = x;
    2.24              fake.button.y = y;
    2.25              fake.button.windowID = event->wheel.windowID;
    2.26  
    2.27 -            if (event->wheel.y) {
    2.28 -                if (event->wheel.y > 0) {
    2.29 -                    fake.button.button = SDL_BUTTON_WHEELUP;
    2.30 -                } else {
    2.31 -                    fake.button.button = SDL_BUTTON_WHEELDOWN;
    2.32 -                }
    2.33 +            fake.type = SDL_MOUSEBUTTONDOWN;
    2.34 +            fake.button.state = SDL_PRESSED;
    2.35 +            SDL_PushEvent(&fake);
    2.36  
    2.37 -                fake.type = SDL_MOUSEBUTTONDOWN;
    2.38 -                fake.button.state = SDL_PRESSED;
    2.39 -                SDL_PushEvent(&fake);
    2.40 -
    2.41 -                fake.type = SDL_MOUSEBUTTONUP;
    2.42 -                fake.button.state = SDL_RELEASED;
    2.43 -                SDL_PushEvent(&fake);
    2.44 -            }
    2.45 -            if (event->wheel.x) {
    2.46 -                if (event->wheel.y > 0) {
    2.47 -                    fake.button.button = SDL_BUTTON_WHEELLEFT;
    2.48 -                } else {
    2.49 -                    fake.button.button = SDL_BUTTON_WHEELRIGHT;
    2.50 -                }
    2.51 -
    2.52 -                fake.type = SDL_MOUSEBUTTONDOWN;
    2.53 -                fake.button.state = SDL_PRESSED;
    2.54 -                SDL_PushEvent(&fake);
    2.55 -
    2.56 -                fake.type = SDL_MOUSEBUTTONUP;
    2.57 -                fake.button.state = SDL_RELEASED;
    2.58 -                SDL_PushEvent(&fake);
    2.59 -            }
    2.60 -
    2.61 +            fake.type = SDL_MOUSEBUTTONUP;
    2.62 +            fake.button.state = SDL_RELEASED;
    2.63 +            SDL_PushEvent(&fake);
    2.64              break;
    2.65          }
    2.66