comparison engine/core/video/cursor.cpp @ 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 f2195628947b
children 37d2b163ef5a
comparison
equal deleted inserted replaced
260:a0068e00f076 261:4fa875d06e28
93 } 93 }
94 94
95 void Cursor::set(MouseCursorType ctype, unsigned int cursor_id) { 95 void Cursor::set(MouseCursorType ctype, unsigned int cursor_id) {
96 m_cursor_id = cursor_id; 96 m_cursor_id = cursor_id;
97 m_cursor_type = ctype; 97 m_cursor_type = ctype;
98 int mx, my;
99 SDL_GetMouseState(&mx, &my);
100
98 if (ctype == CURSOR_NATIVE) { 101 if (ctype == CURSOR_NATIVE) {
99 SDL_ShowCursor(1); 102 if (!SDL_ShowCursor(1)) {
103 SDL_PumpEvents();
104 SDL_WarpMouse(mx, my);
105 }
100 setNativeCursor(cursor_id); 106 setNativeCursor(cursor_id);
101 } else { 107 } else {
102 SDL_ShowCursor(0); 108 if (SDL_ShowCursor(0)) {
109 SDL_PumpEvents();
110 SDL_WarpMouse(mx, my);
111 }
103 if (ctype == CURSOR_ANIMATION) { 112 if (ctype == CURSOR_ANIMATION) {
104 m_animtime = m_timemanager->getTime(); 113 m_animtime = m_timemanager->getTime();
105 } 114 }
106 } 115 }
107 } 116 }