Hi...

I didn't see any discussion about support for the scroll wheel when
using SDL, so here's a patch to enable it. (In case this was a
redundant effort... oh well, it didn't take long)

/TomB



--- DirectFB-0.9.21.orig/systems/sdl/sdlinput.c 2004-08-04
09:58:18.000000000 -0700
+++ DirectFB-0.9.21/systems/sdl/sdlinput.c      2004-09-03
18:20:18.000000000 -0700
@@ -359,6 +359,20 @@
                               case SDL_BUTTON_RIGHT:
                                    evt.button = DIBI_RIGHT;
                                    break;
+                              case SDL_BUTTON_WHEELUP:
+                              case SDL_BUTTON_WHEELDOWN:
+                                   if (event.type != SDL_MOUSEBUTTONDOWN) {
+                                        fusion_skirmish_prevail(
&dfb_sdl->lock );
+                                        continue;
+                                   }
+                                   evt.type  = DIET_AXISMOTION;
+                                   evt.flags = DIEF_AXISREL;
+                                   evt.axis  = DIAI_Z;
+                                   if (event.button.button ==
SDL_BUTTON_WHEELUP)
+                                        evt.axisrel = -1;
+                                   else
+                                        evt.axisrel = 1;
+                                   break;
                               default:
                                    fusion_skirmish_prevail( &dfb_sdl->lock );
                                    continue;


Reply via email to