equal
deleted
inserted
replaced
321 } |
321 } |
322 |
322 |
323 /* Set the relative mode */ |
323 /* Set the relative mode */ |
324 mouse->relative_mode = enabled; |
324 mouse->relative_mode = enabled; |
325 |
325 |
326 if (!enabled && mouse->focus) { |
326 if (enabled) { |
|
327 /* Save the expected mouse position */ |
|
328 mouse->original_x = mouse->x; |
|
329 mouse->original_y = mouse->y; |
|
330 } else if (mouse->focus) { |
327 /* Restore the expected mouse position */ |
331 /* Restore the expected mouse position */ |
328 SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y); |
332 SDL_WarpMouseInWindow(mouse->focus, mouse->original_x, mouse->original_y); |
329 } |
333 } |
330 |
334 |
331 /* Flush pending mouse motion */ |
335 /* Flush pending mouse motion */ |
332 SDL_FlushEvent(SDL_MOUSEMOTION); |
336 SDL_FlushEvent(SDL_MOUSEMOTION); |
333 |
337 |