Mercurial > sdl-ios-xcode
comparison src/events/SDL_mouse.c @ 3777:54d08ecec1cb gsoc2008_manymouse
Sharpened code looks and a minor events upgrade
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Wed, 06 Aug 2008 09:29:32 +0000 |
parents | a9c2a7071874 |
children | a9370b995ded |
comparison
equal
deleted
inserted
replaced
3776:a9c2a7071874 | 3777:54d08ecec1cb |
---|---|
336 | 336 |
337 int | 337 int |
338 SDL_SendProximity(int id, int x, int y, int type) | 338 SDL_SendProximity(int id, int x, int y, int type) |
339 { | 339 { |
340 int index=SDL_GetIndexById(id); | 340 int index=SDL_GetIndexById(id); |
341 SDL_Mouse* mouse=SDL_GetMouse(index); | |
341 int posted=0; | 342 int posted=0; |
342 last_x=x; | 343 last_x=x; |
343 last_y=y; | 344 last_y=y; |
344 if(SDL_ProcessEvents[type]==SDL_ENABLE) | 345 if(SDL_ProcessEvents[type]==SDL_ENABLE) |
345 { | 346 { |
346 SDL_Event event; | 347 SDL_Event event; |
347 event.proximity.which=(Uint8)index; | 348 event.proximity.which=(Uint8)index; |
348 event.proximity.x=x; | 349 event.proximity.x=x; |
349 event.proximity.y=y; | 350 event.proximity.y=y; |
351 event.proximity.cursor=mouse->current_end; | |
350 event.type=type; | 352 event.type=type; |
351 event.proximity.type=type; | 353 event.proximity.type=type; |
352 posted = (SDL_PushEvent(&event) > 0); | 354 posted = (SDL_PushEvent(&event) > 0); |
353 if(type==SDL_PROXIMITYIN) | 355 if(type==SDL_PROXIMITYIN) |
354 { | 356 { |
355 SDL_mice[index]->proximity=SDL_TRUE; | 357 mouse->proximity=SDL_TRUE; |
356 } | 358 } |
357 else | 359 else |
358 { | 360 { |
359 SDL_mice[index]->proximity=SDL_FALSE; | 361 mouse->proximity=SDL_FALSE; |
360 } | 362 } |
361 } | 363 } |
362 return posted; | 364 return posted; |
363 } | 365 } |
364 | 366 |
365 int | 367 int |
366 SDL_SendMouseMotion(int id, int relative, int x, int y,int z) | 368 SDL_SendMouseMotion(int id, int relative, int x, int y,int pressure) |
367 { | 369 { |
368 int index=SDL_GetIndexById(id); | 370 int index=SDL_GetIndexById(id); |
369 SDL_Mouse *mouse = SDL_GetMouse(index); | 371 SDL_Mouse *mouse = SDL_GetMouse(index); |
370 int posted; | 372 int posted; |
371 int xrel; | 373 int xrel; |
438 mouse->y+=yrel; | 440 mouse->y+=yrel; |
439 } | 441 } |
440 } | 442 } |
441 mouse->xdelta += xrel; | 443 mouse->xdelta += xrel; |
442 mouse->ydelta += yrel; | 444 mouse->ydelta += yrel; |
443 mouse->pressure=z; | 445 mouse->pressure=pressure; |
444 | 446 |
445 /* Move the mouse cursor, if needed */ | 447 /* Move the mouse cursor, if needed */ |
446 if (mouse->cursor_shown && !mouse->relative_mode && | 448 if (mouse->cursor_shown && !mouse->relative_mode && |
447 mouse->MoveCursor && mouse->cur_cursor) { | 449 mouse->MoveCursor && mouse->cur_cursor) { |
448 mouse->MoveCursor(mouse->cur_cursor); | 450 mouse->MoveCursor(mouse->cur_cursor); |
449 } | 451 } |
450 | 452 |
451 /* Post the event, if desired */ | 453 /* Post the event, if desired */ |
452 posted = 0; | 454 posted = 0; |
453 if (SDL_ProcessEvents[SDL_MOUSEMOTION] == SDL_ENABLE && SDL_mice[index]->proximity==SDL_TRUE) { | 455 if (SDL_ProcessEvents[SDL_MOUSEMOTION] == SDL_ENABLE && \ |
456 mouse->proximity==SDL_TRUE) { | |
454 SDL_Event event; | 457 SDL_Event event; |
455 event.motion.type = SDL_MOUSEMOTION; | 458 event.motion.type = SDL_MOUSEMOTION; |
456 event.motion.which = (Uint8) index; | 459 event.motion.which = (Uint8) index; |
457 event.motion.state = mouse->buttonstate; | 460 event.motion.state = mouse->buttonstate; |
458 event.motion.x = mouse->x; | 461 event.motion.x = mouse->x; |