I compared:
https://github.com/OoliteProject/oolite ... #L137-L143
with:
https://github.com/OoliteProject/oolite ... #L137-L144
There is an additional wheelDelta variable in the latter. Presumably there was an addition made to the SDL to support the mouse wheel or something like that. I guess there must be a corresponding source code in a source file to go along with the header variable? Unfortunately there is no text "wheelDelta" anywhere in the DevlibsBuildFiles64 folder which leads me to think that the change is missing.
Does anyone have this code?
Missing code in Windows build environment - no wheelDelta in SDL_MouseButtonEvent in DevlibsBuildFiles64
Moderators: winston, another_commander
-
- Quite Grand Sub-Admiral
- Posts: 6924
- Joined: Wed Feb 28, 2007 7:54 am
Re: Missing code in Windows build environment - no wheelDelta in SDL_MouseButtonEvent in DevlibsBuildFiles64
It should be in the SDL patch file in Windows dependencies. The source for the mouse wheel is part of the modified SDL binary we use.
-
- Quite Grand Sub-Admiral
- Posts: 6924
- Joined: Wed Feb 28, 2007 7:54 am
Re: Missing code in Windows build environment - no wheelDelta in SDL_MouseButtonEvent in DevlibsBuildFiles64
Back on the dev computer now, here is the SDL source code modifications necessary for mouse wheel support under Windows:
Hope it helps.
Code: Select all
diff -ruN SDL-1.2.13/include/SDL_events.h SDL-1.2.13_new/include/SDL_events.h
--- SDL-1.2.13/include/SDL_events.h 2007-12-31 06:48:36 +0200
+++ SDL-1.2.13_new/include/SDL_events.h 2022-09-11 18:22:31 +0300
@@ -140,6 +140,7 @@
Uint8 button; /* The mouse button index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
+ short wheelDelta; /* The delta of the mousewheel movement */
} SDL_MouseButtonEvent;
/* Joystick axis motion event structure */
diff -ruN SDL-1.2.13/src/events/SDL_mouse.c SDL-1.2.13_new/src/events/SDL_mouse.c
diff -ruN SDL-1.2.13/src/events/SDL_events_c.h SDL-1.2.13_new/src/events/SDL_events_c.h
--- SDL-1.2.13/src/events/SDL_events_c.h 2007-12-31 06:47:59 +0200
+++ SDL-1.2.13_new/src/events/SDL_events_c.h 2022-09-11 18:22:31 +0300
@@ -57,7 +57,7 @@
extern int SDL_PrivateAppActive(Uint8 gain, Uint8 state);
extern int SDL_PrivateMouseMotion(Uint8 buttonstate, int relative,
Sint16 x, Sint16 y);
-extern int SDL_PrivateMouseButton(Uint8 state, Uint8 button,Sint16 x,Sint16 y);
+extern int SDL_PrivateMouseButton(Uint8 state, Uint8 button,Sint16 x,Sint16 y, short wDelta);
extern int SDL_PrivateKeyboard(Uint8 state, SDL_keysym *key);
extern int SDL_PrivateResize(int w, int h);
extern int SDL_PrivateExpose(void);
--- SDL-1.2.13/src/events/SDL_mouse.c 2007-12-31 06:47:59 +0200
+++ SDL-1.2.13_new/src/events/SDL_mouse.c 2022-09-11 18:22:31 +0300
@@ -60,7 +60,7 @@
Uint8 i;
for ( i = 0; i < sizeof(SDL_ButtonState)*8; ++i ) {
if ( SDL_ButtonState & SDL_BUTTON(i) ) {
- SDL_PrivateMouseButton(SDL_RELEASED, i, 0, 0);
+ SDL_PrivateMouseButton(SDL_RELEASED, i, 0, 0, 0);
}
}
}
@@ -189,7 +189,7 @@
return(posted);
}
-int SDL_PrivateMouseButton(Uint8 state, Uint8 button, Sint16 x, Sint16 y)
+int SDL_PrivateMouseButton(Uint8 state, Uint8 button, Sint16 x, Sint16 y, short wDelta)
{
SDL_Event event;
int posted;
@@ -253,6 +253,7 @@
event.button.button = button;
event.button.x = x;
event.button.y = y;
+ event.button.wheelDelta = button == SDL_BUTTON_WHEELUP || SDL_BUTTON_WHEELDOWN ? wDelta : 0;
if ( (SDL_EventOK == NULL) || (*SDL_EventOK)(&event) ) {
posted = 1;
SDL_PushEvent(&event);
diff -ruN SDL-1.2.13/src/video/wincommon/SDL_sysevents.c SDL-1.2.13_new/src/video/wincommon/SDL_sysevents.c
--- SDL-1.2.13/src/video/wincommon/SDL_sysevents.c 2007-12-31 06:48:02 +0200
+++ SDL-1.2.13_new/src/video/wincommon/SDL_sysevents.c 2022-09-11 18:22:31 +0300
@@ -557,7 +557,7 @@
#endif
}
posted = SDL_PrivateMouseButton(
- state, button, x, y);
+ state, button, x, y, 0);
/*
* MSDN says:
@@ -579,7 +579,7 @@
#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
case WM_MOUSEWHEEL:
if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
- int move = (short)HIWORD(wParam);
+ short move = GET_WHEEL_DELTA_WPARAM(wParam);
if ( move ) {
Uint8 button;
if ( move > 0 )
@@ -587,9 +587,9 @@
else
button = SDL_BUTTON_WHEELDOWN;
posted = SDL_PrivateMouseButton(
- SDL_PRESSED, button, 0, 0);
+ SDL_PRESSED, button, 0, 0, move);
posted |= SDL_PrivateMouseButton(
- SDL_RELEASED, button, 0, 0);
+ SDL_RELEASED, button, 0, 0, move);
}
}
return(0);
diff -ruN SDL-1.2.13/src/video/windx5/SDL_dx5events.c SDL-1.2.13_new/src/video/windx5/SDL_dx5events.c
--- SDL-1.2.13/src/video/windx5/SDL_dx5events.c 2007-12-31 06:48:13 +0200
+++ SDL-1.2.13_new/src/video/windx5/SDL_dx5events.c 2022-09-11 18:22:31 +0300
@@ -370,7 +370,7 @@
if ( button == 3 ) button = 1;
}
posted = SDL_PrivateMouseButton(state, button,
- 0, 0);
+ 0, 0, 0);
}
old_state >>= 1;
new_state >>= 1;
@@ -416,14 +416,15 @@
yrel = 0;
}
timestamp = 0;
- if((int)ptrbuf[i].dwData > 0)
+ int move = (int)ptrbuf[i].dwData;
+ if(move > 0)
button = SDL_BUTTON_WHEELUP;
else
button = SDL_BUTTON_WHEELDOWN;
posted = SDL_PrivateMouseButton(
- SDL_PRESSED, button, 0, 0);
+ SDL_PRESSED, button, 0, 0, move);
posted |= SDL_PrivateMouseButton(
- SDL_RELEASED, button, 0, 0);
+ SDL_RELEASED, button, 0, 0, move);
break;
case DIMOFS_BUTTON0:
case DIMOFS_BUTTON1:
@@ -466,7 +467,7 @@
if ( button == 3 ) button = 1;
}
posted = SDL_PrivateMouseButton(state, button,
- 0, 0);
+ 0, 0, 0);
break;
}
}