comparison src/video/quartz/SDL_QuartzEvents.m @ 615:7ec821f3cbd0

Date: Thu, 17 Apr 2003 23:27:34 -0400 From: Darrell Walisser Subject: Yet another OS X cursor bug The synopsis: 1. Call SDL_ShowCursor(0); 2. Call SDL_SetVideoMode(); 3. Call SDL_GetEvent(); 3. Call SDL_ShowCursor(1); The result: Sometimes the cursor doesn't come back! Ack! Oddly enough, it does come back when mousing over the dock or clicking in the menu bar. But that's besides the point. The reason why this is happening is a flaw in the handling of activation/deactivation events. The short explanation is that the HideCursor() and ShowCursor() calls must be balanced, but if the cursor was initially hidden, HideCursor() was called again on the activate event - so now the next ShowCursor() fails (as does the next, and the next, for some reason). So, here's the patch. All it does is keep track of the HideCursor()/ShowCursor() calls so that they will always be balanced.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 20 Apr 2003 05:41:16 +0000
parents 04dcaf3da918
children bf816ce70144
comparison
equal deleted inserted replaced
614:0b4c3f5ff63d 615:7ec821f3cbd0
299 299
300 static void QZ_DoActivate (_THIS) 300 static void QZ_DoActivate (_THIS)
301 { 301 {
302 in_foreground = YES; 302 in_foreground = YES;
303 303
304 /* Hide the mouse cursor if was hidden */ 304 /* Hide the cursor if it was hidden by SDL_ShowCursor() */
305 if (!cursor_visible) { 305 if (!cursor_visible && !cursor_hidden) {
306 HideCursor (); 306 HideCursor ();
307 cursor_hidden = YES;
307 } 308 }
308 309
309 /* Regrab input, only if it was previously grabbed */ 310 /* Regrab input, only if it was previously grabbed */
310 if ( current_grab_mode == SDL_GRAB_ON ) { 311 if ( current_grab_mode == SDL_GRAB_ON ) {
311 312
328 QZ_PrivateCocoaToSDL (this, &cursor_loc); 329 QZ_PrivateCocoaToSDL (this, &cursor_loc);
329 330
330 /* Reassociate mouse and cursor */ 331 /* Reassociate mouse and cursor */
331 CGAssociateMouseAndMouseCursorPosition (1); 332 CGAssociateMouseAndMouseCursorPosition (1);
332 333
333 /* Show the cursor */ 334 /* Show the cursor if it was hidden by SDL_ShowCursor() */
334 ShowCursor (); 335 if (!cursor_visible && cursor_hidden) {
336 ShowCursor ();
337 cursor_hidden = NO;
338 }
335 339
336 SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS); 340 SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS);
337 } 341 }
338 342
339 void QZ_SleepNotificationHandler (void * refcon, 343 void QZ_SleepNotificationHandler (void * refcon,