comparison src/events/SDL_mouse.c @ 2712:c4e697245676

Fixed compile errors introduced during the merge refactoring
author Sam Lantinga <slouken@libsdl.org>
date Mon, 25 Aug 2008 08:50:37 +0000
parents 44e49d3fa6cf
children abacf2555bb4
comparison
equal deleted inserted replaced
2711:62e7af9b2b67 2712:c4e697245676
74 SDL_IdIndex[id] = index; 74 SDL_IdIndex[id] = index;
75 } 75 }
76 return 1; 76 return 1;
77 } 77 }
78 78
79 SDL_Mouse * 79 int
80 SDL_GetMouseByID(int id) 80 SDL_GetMouseIndexId(int id)
81 { 81 {
82 if (id < 0 || id > SDL_highestId) { 82 if (id < 0 || id > SDL_highestId) {
83 return NULL; 83 return -1;
84 } 84 }
85 return SDL_GetMouse(SDL_IdIndex[id]); 85 return SDL_IdIndex[id];
86 } 86 }
87 87
88 int 88 int
89 SDL_AddMouse(const SDL_Mouse * mouse, int index, char *name, int pressure_max, 89 SDL_AddMouse(const SDL_Mouse * mouse, int index, char *name, int pressure_max,
90 int pressure_min, int ends) 90 int pressure_min, int ends)
319 } 319 }
320 320
321 void 321 void
322 SDL_SetMouseFocus(int id, SDL_WindowID windowID) 322 SDL_SetMouseFocus(int id, SDL_WindowID windowID)
323 { 323 {
324 SDL_Mouse *mouse = SDL_GetMouseByID(id); 324 int index = SDL_GetMouseIndexId(id);
325 int i, index; 325 SDL_Mouse *mouse = SDL_GetMouse(index);
326 int i;
326 SDL_bool focus; 327 SDL_bool focus;
327 328
328 if (!mouse || (mouse->focus == windowID)) { 329 if (!mouse || (mouse->focus == windowID)) {
329 return; 330 return;
330 } 331 }
331
332 index = SDL_IdIndex[id];
333 332
334 /* See if the current window has lost focus */ 333 /* See if the current window has lost focus */
335 if (mouse->focus) { 334 if (mouse->focus) {
336 focus = SDL_FALSE; 335 focus = SDL_FALSE;
337 for (i = 0; i < SDL_num_mice; ++i) { 336 for (i = 0; i < SDL_num_mice; ++i) {
370 } 369 }
371 370
372 int 371 int
373 SDL_SendProximity(int id, int x, int y, int type) 372 SDL_SendProximity(int id, int x, int y, int type)
374 { 373 {
375 SDL_Mouse *mouse = SDL_GetMouseByID(id); 374 int index = SDL_GetMouseIndexId(id);
375 SDL_Mouse *mouse = SDL_GetMouse(index);
376 int posted = 0; 376 int posted = 0;
377 last_x = x; 377 last_x = x;
378 last_y = y; 378 last_y = y;
379 if (SDL_ProcessEvents[type] == SDL_ENABLE) { 379 if (SDL_ProcessEvents[type] == SDL_ENABLE) {
380 SDL_Event event; 380 SDL_Event event;
394 } 394 }
395 395
396 int 396 int
397 SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure) 397 SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure)
398 { 398 {
399 SDL_Mouse *mouse = SDL_GetMouseByID(id); 399 int index = SDL_GetMouseIndexId(id);
400 SDL_Mouse *mouse = SDL_GetMouse(index);
400 int posted; 401 int posted;
401 int xrel; 402 int xrel;
402 int yrel; 403 int yrel;
403 404
404 /* while using the relative mode and many windows, we have to be sure, 405 /* while using the relative mode and many windows, we have to be sure,
489 } 490 }
490 491
491 int 492 int
492 SDL_SendMouseButton(int id, Uint8 state, Uint8 button) 493 SDL_SendMouseButton(int id, Uint8 state, Uint8 button)
493 { 494 {
494 SDL_Mouse *mouse = SDL_GetMouseByID(id); 495 int index = SDL_GetMouseIndexId(id);
496 SDL_Mouse *mouse = SDL_GetMouse(index);
495 int posted; 497 int posted;
496 Uint8 type; 498 Uint8 type;
497 499
498 if (!mouse) { 500 if (!mouse) {
499 return 0; 501 return 0;
775 } 777 }
776 778
777 void 779 void
778 SDL_ChangeEnd(int id, int end) 780 SDL_ChangeEnd(int id, int end)
779 { 781 {
780 SDL_Mouse *mouse = SDL_GetMouseByID(id); 782 int index = SDL_GetMouseIndexId(id);
783 SDL_Mouse *mouse = SDL_GetMouse(index);
781 784
782 if (mouse) { 785 if (mouse) {
783 mouse->current_end = end; 786 mouse->current_end = end;
784 } 787 }
785 } 788 }