Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 2152:003c1b5b07da
Fixed bug #382
Added horizontal scrolling support
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 06 Jul 2007 09:22:18 +0000 |
parents | 3ee59c43d784 |
children | 760c1bd2d625 |
comparison
equal
deleted
inserted
replaced
2151:1e0692271600 | 2152:003c1b5b07da |
---|---|
254 | 254 |
255 selected = SDL_SelectMouse(event->wheel.which); | 255 selected = SDL_SelectMouse(event->wheel.which); |
256 SDL_GetMouseState(&x, &y); | 256 SDL_GetMouseState(&x, &y); |
257 SDL_SelectMouse(selected); | 257 SDL_SelectMouse(selected); |
258 | 258 |
259 if (event->wheel.motion > 0) { | |
260 button = SDL_BUTTON_WHEELUP; | |
261 } else { | |
262 button = SDL_BUTTON_WHEELDOWN; | |
263 } | |
264 | |
265 fake.button.which = event->wheel.windowID; | 259 fake.button.which = event->wheel.windowID; |
266 fake.button.button = button; | |
267 fake.button.x = x; | 260 fake.button.x = x; |
268 fake.button.y = y; | 261 fake.button.y = y; |
269 fake.button.windowID = event->wheel.windowID; | 262 fake.button.windowID = event->wheel.windowID; |
270 | 263 |
271 fake.type = SDL_MOUSEBUTTONDOWN; | 264 if (event->wheel.y) { |
272 fake.button.state = SDL_PRESSED; | 265 if (event->wheel.y > 0) { |
273 SDL_PushEvent(&fake); | 266 fake.button.button = SDL_BUTTON_WHEELUP; |
274 | 267 } else { |
275 fake.type = SDL_MOUSEBUTTONUP; | 268 fake.button.button = SDL_BUTTON_WHEELDOWN; |
276 fake.button.state = SDL_RELEASED; | 269 } |
277 SDL_PushEvent(&fake); | 270 |
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 | |
278 break; | 295 break; |
279 } | 296 } |
280 | 297 |
281 } | 298 } |
282 return 1; | 299 return 1; |