diff --git a/mozilla/widget/src/mac/nsMacMessagePump.cpp b/mozilla/widget/src/mac/nsMacMessagePump.cpp index ea5011332fb..f6883307596 100644 --- a/mozilla/widget/src/mac/nsMacMessagePump.cpp +++ b/mozilla/widget/src/mac/nsMacMessagePump.cpp @@ -219,7 +219,7 @@ void nsMacMessagePump::DoMessagePump() PRBool haveEvent; EventRecord theEvent; - mInBackground = PR_FALSE; + nsToolkit::AppInForeground(); while (mRunning) { @@ -384,9 +384,9 @@ void nsMacMessagePump::DispatchEvent(PRBool aRealEvent, EventRecord *anEvent) { case suspendResumeMessage: if ((anEvent->message & 1) == resumeFlag) - mInBackground = PR_FALSE; // resume message + nsToolkit::AppInForeground(); // resume message else - mInBackground = PR_TRUE; // suspend message + nsToolkit::AppInBackground(); // suspend message DoMouseMove(*anEvent); break; @@ -710,7 +710,7 @@ void nsMacMessagePump::DoMouseMove(EventRecord &anEvent) if (mMouseRgn) { - Point globalMouse = anEvent.where; + Point globalMouse = anEvent.where; ::SetRectRgn(mMouseRgn, globalMouse.h, globalMouse.v, globalMouse.h + 1, globalMouse.v + 1); } @@ -859,7 +859,7 @@ void nsMacMessagePump::DoIdle(EventRecord &anEvent) EventRecord localEvent = anEvent; localEvent.what = nullEvent; lastWhere = localEvent.where; - DoMouseMove(localEvent); + DoMouseMove(localEvent); } diff --git a/mozilla/widget/src/mac/nsMacMessagePump.h b/mozilla/widget/src/mac/nsMacMessagePump.h index 40090ec0a20..9760ee204f3 100644 --- a/mozilla/widget/src/mac/nsMacMessagePump.h +++ b/mozilla/widget/src/mac/nsMacMessagePump.h @@ -56,7 +56,6 @@ private: PRBool mRunning; Point mMousePoint; // keep track of where the mouse is at all times RgnHandle mMouseRgn; - PRBool mInBackground; nsToolkit* mToolkit; nsMacMessageSink* mMessageSink; nsMacTSMMessagePump* mTSMMessagePump; diff --git a/mozilla/widget/src/mac/nsToolkit.cpp b/mozilla/widget/src/mac/nsToolkit.cpp index 618806e4925..e824e742c75 100644 --- a/mozilla/widget/src/mac/nsToolkit.cpp +++ b/mozilla/widget/src/mac/nsToolkit.cpp @@ -140,6 +140,11 @@ void nsMacNSPREventQueueHandler::ProcessPLEventQueue() NS_IMPL_THREADSAFE_ISUPPORTS1(nsToolkit, nsIToolkit); + +// assume we begin as the fg app +bool nsToolkit::sInForeground = true; + + //------------------------------------------------------------------------- // //------------------------------------------------------------------------- @@ -209,6 +214,28 @@ bool nsToolkit::HasAppearanceManager() return hasAppearanceManager; } + +void +nsToolkit :: AppInForeground ( ) +{ + sInForeground = true; +} + + +void +nsToolkit :: AppInBackground ( ) +{ + sInForeground = false; +} + + +bool +nsToolkit :: IsAppInForeground ( ) +{ + return sInForeground; +} + + //------------------------------------------------------------------------- // // Return the nsIToolkit for the current thread. If a toolkit does not diff --git a/mozilla/widget/src/mac/nsToolkit.h b/mozilla/widget/src/mac/nsToolkit.h index 4e9568cd499..075d7433cc3 100644 --- a/mozilla/widget/src/mac/nsToolkit.h +++ b/mozilla/widget/src/mac/nsToolkit.h @@ -66,9 +66,15 @@ public: // Appearance Mgr static bool HasAppearanceManager(); + + // helpers to determine if the app is in the fg or bg + static void AppInForeground ( ) ; + static void AppInBackground ( ) ; + static bool IsAppInForeground ( ) ; protected: bool mInited; + static bool sInForeground; }; diff --git a/mozilla/widget/src/mac/nsWindow.cpp b/mozilla/widget/src/mac/nsWindow.cpp index 6c19c96ec01..a65f85fea06 100644 --- a/mozilla/widget/src/mac/nsWindow.cpp +++ b/mozilla/widget/src/mac/nsWindow.cpp @@ -584,6 +584,11 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor) { nsBaseWidget::SetCursor(aCursor); + // allow the cursor to be set internally if we're in the bg, but + // don't actually set it. + if ( !nsToolkit::IsAppInForeground() ) + return NS_OK; + // mac specific cursor manipulation //ĄTODO: We need a way to get non-os cursors here. if (nsToolkit::HasAppearanceManager())