Fix for bug 7956, don't change cursor when app is in background. added knowledge of if we're in the bg to the nsToolkit and nsWindow now checks it. r=sfraser.
git-svn-id: svn://10.0.0.236/trunk@70792 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
c828e574cc
commit
75d743e1e7
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user