Mercurial > fife-parpg
changeset 261:4fa875d06e28
A workaround for a bug in SDL which makes the cursor jump when SDL_ShowCursor() is called. This patch does not completely fix the problem, but at least makes the editor usable in fullscreen mode.
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 09 Jun 2009 01:09:05 +0000 |
parents | a0068e00f076 |
children | 17eba3872550 |
files | engine/core/video/cursor.cpp |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/video/cursor.cpp Mon Jun 08 21:04:43 2009 +0000 +++ b/engine/core/video/cursor.cpp Tue Jun 09 01:09:05 2009 +0000 @@ -95,11 +95,20 @@ void Cursor::set(MouseCursorType ctype, unsigned int cursor_id) { m_cursor_id = cursor_id; m_cursor_type = ctype; + int mx, my; + SDL_GetMouseState(&mx, &my); + if (ctype == CURSOR_NATIVE) { - SDL_ShowCursor(1); + if (!SDL_ShowCursor(1)) { + SDL_PumpEvents(); + SDL_WarpMouse(mx, my); + } setNativeCursor(cursor_id); } else { - SDL_ShowCursor(0); + if (SDL_ShowCursor(0)) { + SDL_PumpEvents(); + SDL_WarpMouse(mx, my); + } if (ctype == CURSOR_ANIMATION) { m_animtime = m_timemanager->getTime(); }