• Sam Lantinga's avatar
    Fixed bug 1173 (No mouse wheel event on linux/x11) · 65b0f309
    Sam Lantinga authored
     Matthias      2011-03-20 23:07:02 PDT
    
    On X11, SDL 1.3 does not generate a mouse wheel event. Instead, button
    down/buttton up events are generated by SDL. After looking at the code in
    SDL_x11events.c, I assume this is due to the fact that X11 does not have a
    dedicated mouse wheel event.
    
    I did a little research on the behavior of mouse wheel events on X11 systems.
    Apparently, mouse wheel events generate a button down/button up event with the
    same time, i.e. with exact same timestamp.
    
    Attached you can find my changes to SDL_x11events.c, which generates SDL mouse
    wheel events for those button down events that have a button release event
    immediately following it (for the same button, and with the same timestamp).
    
    I did have to make an assumption: As standard X11 implementations know only 5
    buttons, I have mapped Button4 to "wheel up" (i.e. +1), and Button5 to "wheel
    down" (i.e. -1).
    
    Note that if you include this patch, no SDL button down/up events will be
    generated on X11 platforms for mouse wheel events (which is probably a
    significant change for those that have programmed their code to work with
    them).
    65b0f309
Name
Last commit
Last update
..
android Loading commit data...
bwindow Loading commit data...
cocoa Loading commit data...
directfb Loading commit data...
dummy Loading commit data...
nds Loading commit data...
pandora Loading commit data...
uikit Loading commit data...
windows Loading commit data...
x11 Loading commit data...
SDL_RLEaccel.c Loading commit data...
SDL_RLEaccel_c.h Loading commit data...
SDL_blit.c Loading commit data...
SDL_blit.h Loading commit data...
SDL_blit_0.c Loading commit data...
SDL_blit_1.c Loading commit data...
SDL_blit_A.c Loading commit data...
SDL_blit_N.c Loading commit data...
SDL_blit_auto.c Loading commit data...
SDL_blit_auto.h Loading commit data...
SDL_blit_copy.c Loading commit data...
SDL_blit_copy.h Loading commit data...
SDL_blit_slow.c Loading commit data...
SDL_blit_slow.h Loading commit data...
SDL_bmp.c Loading commit data...
SDL_clipboard.c Loading commit data...
SDL_fillrect.c Loading commit data...
SDL_pixels.c Loading commit data...
SDL_pixels_c.h Loading commit data...
SDL_rect.c Loading commit data...
SDL_rect_c.h Loading commit data...
SDL_shape.c Loading commit data...
SDL_shape_internals.h Loading commit data...
SDL_stretch.c Loading commit data...
SDL_surface.c Loading commit data...
SDL_sysvideo.h Loading commit data...
SDL_video.c Loading commit data...
sdlgenblit.pl Loading commit data...