Mercurial > sdl-ios-xcode
comparison src/video/gem/SDL_gemmouse.c @ 4060:0b4ebec67cad SDL-1.2
Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Fri, 13 Jul 2007 18:44:43 +0000 |
parents | 5d14acfdf84d |
children | a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
4059:57b017e6aebf | 4060:0b4ebec67cad |
---|---|
138 } | 138 } |
139 | 139 |
140 int GEM_ShowWMCursor(_THIS, WMcursor *cursor) | 140 int GEM_ShowWMCursor(_THIS, WMcursor *cursor) |
141 { | 141 { |
142 GEM_cursor = cursor; | 142 GEM_cursor = cursor; |
143 if (cursor == NULL) { | 143 |
144 graf_mouse(M_OFF, NULL); | 144 GEM_CheckMouseMode(this); |
145 GEM_cursor = (void *) -1; | |
146 } else if (cursor->mform_p) { | |
147 graf_mouse(USER_DEF, cursor->mform_p); | |
148 } | |
149 | 145 |
150 #ifdef DEBUG_VIDEO_GEM | 146 #ifdef DEBUG_VIDEO_GEM |
151 printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor); | 147 printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor); |
152 #endif | 148 #endif |
153 | 149 |
168 } | 164 } |
169 #endif | 165 #endif |
170 | 166 |
171 void GEM_CheckMouseMode(_THIS) | 167 void GEM_CheckMouseMode(_THIS) |
172 { | 168 { |
169 const Uint8 full_focus = (SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS); | |
170 int set_system_cursor = 1, show_system_cursor = 1; | |
171 | |
173 #ifdef DEBUG_VIDEO_GEM | 172 #ifdef DEBUG_VIDEO_GEM |
174 printf("sdl:video:gem: check mouse mode\n"); | 173 printf("sdl:video:gem: check mouse mode\n"); |
175 #endif | 174 #endif |
176 | 175 |
177 /* If the mouse is hidden and input is grabbed, we use relative mode */ | 176 /* If the mouse is hidden and input is grabbed, we use relative mode */ |
178 if ( (!(SDL_cursorstate & CURSOR_VISIBLE)) && | 177 GEM_mouse_relative = (!(SDL_cursorstate & CURSOR_VISIBLE)) |
179 (this->input_grab != SDL_GRAB_OFF) && | 178 && (this->input_grab != SDL_GRAB_OFF) |
180 (SDL_GetAppState() & SDL_APPACTIVE) ) { | 179 && (SDL_GetAppState() & SDL_APPACTIVE); |
181 SDL_AtariXbios_LockMousePosition(SDL_TRUE); | 180 SDL_AtariXbios_LockMousePosition(GEM_mouse_relative); |
182 GEM_mouse_relative = SDL_TRUE; | 181 |
182 if (SDL_cursorstate & CURSOR_VISIBLE) { | |
183 /* Application defined cursor only over the application window */ | |
184 if ((SDL_GetAppState() & full_focus) == full_focus) { | |
185 if (GEM_cursor) { | |
186 graf_mouse(USER_DEF, GEM_cursor->mform_p); | |
187 set_system_cursor = 0; | |
188 } else { | |
189 show_system_cursor = 0; | |
190 } | |
191 } | |
183 } else { | 192 } else { |
184 SDL_AtariXbios_LockMousePosition(SDL_FALSE); | 193 /* Mouse cursor hidden only over the application window */ |
185 GEM_mouse_relative = SDL_FALSE; | 194 if ((SDL_GetAppState() & full_focus) == full_focus) { |
186 graf_mouse(M_ON, NULL); | 195 set_system_cursor = 0; |
187 } | 196 show_system_cursor = 0; |
188 } | 197 } |
198 } | |
199 | |
200 graf_mouse(show_system_cursor ? M_ON : M_OFF, NULL); | |
201 if (set_system_cursor) { | |
202 graf_mouse(ARROW, NULL); | |
203 } | |
204 } |