comparison src/SDL_compat.c @ 2153:760c1bd2d625

Reverted mousewheel support in 1.2, since it breaks binary compatibility.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 06 Jul 2007 13:45:10 +0000
parents 003c1b5b07da
children 98e76ba7d5a4
comparison
equal deleted inserted replaced
2152:003c1b5b07da 2153:760c1bd2d625
250 { 250 {
251 Uint8 button; 251 Uint8 button;
252 int selected; 252 int selected;
253 int x, y; 253 int x, y;
254 254
255 if (event->wheel.y == 0) {
256 break;
257 }
258
255 selected = SDL_SelectMouse(event->wheel.which); 259 selected = SDL_SelectMouse(event->wheel.which);
256 SDL_GetMouseState(&x, &y); 260 SDL_GetMouseState(&x, &y);
257 SDL_SelectMouse(selected); 261 SDL_SelectMouse(selected);
258 262
263 if (event->wheel.y > 0) {
264 button = SDL_BUTTON_WHEELUP;
265 } else {
266 button = SDL_BUTTON_WHEELDOWN;
267 }
268
259 fake.button.which = event->wheel.windowID; 269 fake.button.which = event->wheel.windowID;
270 fake.button.button = button;
260 fake.button.x = x; 271 fake.button.x = x;
261 fake.button.y = y; 272 fake.button.y = y;
262 fake.button.windowID = event->wheel.windowID; 273 fake.button.windowID = event->wheel.windowID;
263 274
264 if (event->wheel.y) { 275 fake.type = SDL_MOUSEBUTTONDOWN;
265 if (event->wheel.y > 0) { 276 fake.button.state = SDL_PRESSED;
266 fake.button.button = SDL_BUTTON_WHEELUP; 277 SDL_PushEvent(&fake);
267 } else { 278
268 fake.button.button = SDL_BUTTON_WHEELDOWN; 279 fake.type = SDL_MOUSEBUTTONUP;
269 } 280 fake.button.state = SDL_RELEASED;
270 281 SDL_PushEvent(&fake);
271 fake.type = SDL_MOUSEBUTTONDOWN;
272 fake.button.state = SDL_PRESSED;
273 SDL_PushEvent(&fake);
274
275 fake.type = SDL_MOUSEBUTTONUP;
276 fake.button.state = SDL_RELEASED;
277 SDL_PushEvent(&fake);
278 }
279 if (event->wheel.x) {
280 if (event->wheel.y > 0) {
281 fake.button.button = SDL_BUTTON_WHEELLEFT;
282 } else {
283 fake.button.button = SDL_BUTTON_WHEELRIGHT;
284 }
285
286 fake.type = SDL_MOUSEBUTTONDOWN;
287 fake.button.state = SDL_PRESSED;
288 SDL_PushEvent(&fake);
289
290 fake.type = SDL_MOUSEBUTTONUP;
291 fake.button.state = SDL_RELEASED;
292 SDL_PushEvent(&fake);
293 }
294
295 break; 282 break;
296 } 283 }
297 284
298 } 285 }
299 return 1; 286 return 1;