comparison src/video/quartz/SDL_QuartzWM.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 1970e458070d
children 5d2f027b3349
comparison
equal deleted inserted replaced
614:0b4c3f5ff63d 615:7ec821f3cbd0
70 70
71 static int QZ_ShowWMCursor (_THIS, WMcursor *cursor) { 71 static int QZ_ShowWMCursor (_THIS, WMcursor *cursor) {
72 72
73 if ( cursor == NULL) { 73 if ( cursor == NULL) {
74 if ( cursor_visible ) { 74 if ( cursor_visible ) {
75 HideCursor (); 75 if (!cursor_hidden) {
76 HideCursor ();
77 cursor_hidden = YES;
78 }
76 cursor_visible = NO; 79 cursor_visible = NO;
77 QZ_ChangeGrabState (this, QZ_HIDECURSOR); 80 QZ_ChangeGrabState (this, QZ_HIDECURSOR);
78 } 81 }
79 } 82 }
80 else { 83 else {
81 SetCursor(&cursor->curs); 84 SetCursor(&cursor->curs);
82 if ( ! cursor_visible ) { 85 if ( ! cursor_visible ) {
83 ShowCursor (); 86 if (cursor_hidden) {
87 ShowCursor ();
88 cursor_hidden = NO;
89 }
84 cursor_visible = YES; 90 cursor_visible = YES;
85 QZ_ChangeGrabState (this, QZ_SHOWCURSOR); 91 QZ_ChangeGrabState (this, QZ_SHOWCURSOR);
86 } 92 }
87 } 93 }
88 94