Bug 533208 - Only call [NSCursor hide/unhide] when cursor visibility actually changes, since these calls must be balanced. r=josh
authorMarkus Stange <mstange@themasta.com>
Fri, 11 Dec 2009 23:05:21 +0100
changeset 35628 d5e4fb234b23e578c04229ec6623f3e79ae09ef2
parent 35627 0e8f28b19264485d376680746843d01f26b6bd6e
child 35629 ebcff5d4c5fcfc8d646dfc014ac2ba14f63cc717
push id10649
push usermstange@themasta.com
push dateSat, 12 Dec 2009 09:19:37 +0000
treeherdermozilla-central@d379a17cbf8f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh
bugs533208
milestone1.9.3a1pre
Bug 533208 - Only call [NSCursor hide/unhide] when cursor visibility actually changes, since these calls must be balanced. r=josh
widget/src/cocoa/nsCursorManager.mm
--- a/widget/src/cocoa/nsCursorManager.mm
+++ b/widget/src/cocoa/nsCursorManager.mm
@@ -218,26 +218,28 @@ static NSArray* sSpinCursorFrames = nil;
   // reset the state.
   [[NSCursor currentCursor] set];
 
   nsMacCursor* currentCursor = [self getCursor: mCurrentCursor];
 
   if (aCursor != mCurrentCursor || ![currentCursor isSet]) {
     [currentCursor unset];
     [[self getCursor: aCursor] set];
-
-    mCurrentCursor = aCursor;
   }
 
-  if (mCurrentCursor == eCursor_none) {
-    [NSCursor hide];
-  } else {
-    [NSCursor unhide];
+  if (mCurrentCursor != aCursor) {
+    if (aCursor == eCursor_none) {
+      [NSCursor hide];
+    } else if (mCurrentCursor == eCursor_none) {
+      [NSCursor unhide];
+    }
   }
 
+  mCurrentCursor = aCursor;
+
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (nsMacCursor *) getCursor: (enum nsCursor) aCursor
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   nsMacCursor * result = [mCursors objectForKey: [NSNumber numberWithInt: aCursor]];