turn off watch cursor before going into native code. make the cursor not turn on when library loads so embedding clients don't get screwed. r=pchen/a=hyatt, bug# 53121.

This commit is contained in:
pinkerton%netscape.com 2000-10-06 00:57:40 +00:00
parent a6f5bcaa30
commit 7c657e653d
6 changed files with 47 additions and 12 deletions

View File

@ -46,14 +46,7 @@ nsWatchTask :: nsWatchTask ( )
: mChecksum('mozz'), mSelf(this), mTicks(::TickCount()), mBusy(PR_FALSE), mSuspended(PR_FALSE),
mInstallSucceeded(PR_FALSE), mAnimation(0)
{
// setup the task
mTask.qType = vType;
mTask.vblAddr = NewVBLProc((VBLProcPtr)DoWatchTask);
mTask.vblCount = kRepeatInterval;
mTask.vblPhase = 0;
// install it
mInstallSucceeded = ::VInstall((QElemPtr)&mTask) == noErr;
}
@ -65,6 +58,28 @@ nsWatchTask :: ~nsWatchTask ( )
}
//
// Start
//
// Registers the VBL task and does other various init tasks to begin
// watching for time away from the event loop. It is ok to call other
// methods on this object w/out calling Start().
//
void
nsWatchTask :: Start ( )
{
// setup the task
mTask.qType = vType;
mTask.vblAddr = NewVBLProc((VBLProcPtr)DoWatchTask);
mTask.vblCount = kRepeatInterval;
mTask.vblPhase = 0;
// install it
mInstallSucceeded = ::VInstall((QElemPtr)&mTask) == noErr;
} // Start
//
// DoWatchTask
//

View File

@ -44,6 +44,11 @@ public:
nsWatchTask ( ) ;
~nsWatchTask ( ) ;
// Registers the VBL task and does other various init tasks to begin
// watching for time away from the event loop. It is ok to call other
// methods on this object w/out calling Start().
NS_GFX void Start ( ) ;
// call from the main event loop
NS_GFX void EventLoopReached ( ) ;

View File

@ -171,8 +171,6 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
//
static pascal void FileDialogEventHandlerProc( NavEventCallbackMessage msg, NavCBRecPtr cbRec, NavCallBackUserData data )
{
nsWatchTask::GetTask().EventLoopReached();
switch ( msg ) {
case kNavCBEvent:
switch ( cbRec->eventData.eventDataParms.event->what ) {
@ -302,6 +300,7 @@ nsFilePicker::GetLocalFile(Str255 & inTitle, /* filter list here later */ FSSpec
// Display the get file dialog. Only use a filter proc if there are any
// filters registered.
nsWatchTask::GetTask().Suspend();
anErr = ::NavGetFile(
NULL,
&reply,
@ -311,6 +310,7 @@ nsFilePicker::GetLocalFile(Str255 & inTitle, /* filter list here later */ FSSpec
mFilters.Count() ? filterProc : NULL,
NULL, //typeList,
this); // callbackUD - used by the filterProc
nsWatchTask::GetTask().Resume();
// See if the user has selected save
if (anErr == noErr && reply.validRecord) {
@ -369,6 +369,7 @@ nsFilePicker::GetLocalFolder(Str255 & inTitle, FSSpec* outSpec)
::BlockMoveData(inTitle, dialogOptions.message, *inTitle + 1);
// Display the get file dialog
nsWatchTask::GetTask().Suspend();
anErr = ::NavChooseFolder(
NULL,
&reply,
@ -376,6 +377,7 @@ nsFilePicker::GetLocalFolder(Str255 & inTitle, FSSpec* outSpec)
eventProc,
NULL, // filter proc
NULL); // callbackUD
nsWatchTask::GetTask().Resume();
// See if the user has selected save
if (anErr == noErr && reply.validRecord) {
@ -426,6 +428,7 @@ nsFilePicker::PutLocalFile(Str255 & inTitle, Str255 & inDefaultName, FSSpec* out
::BlockMoveData(inDefaultName, dialogOptions.savedFileName, *inDefaultName + 1);
// Display the get file dialog
nsWatchTask::GetTask().Suspend();
anErr = ::NavPutFile(
NULL,
&reply,
@ -434,6 +437,7 @@ nsFilePicker::PutLocalFile(Str255 & inTitle, Str255 & inDefaultName, FSSpec* out
typeToSave,
creatorToSave,
NULL); // callbackUD
nsWatchTask::GetTask().Resume();
// See if the user has selected save
if (anErr == noErr && reply.validRecord)

View File

@ -205,8 +205,6 @@ PRBool nsFileWidget::Show()
//-------------------------------------------------------------------------
static pascal void myProc ( NavEventCallbackMessage msg, NavCBRecPtr cbRec, NavCallBackUserData data )
{
nsWatchTask::GetTask().EventLoopReached();
switch ( msg ) {
case kNavCBEvent:
switch ( cbRec->eventData.eventDataParms.event->what ) {
@ -252,6 +250,7 @@ nsFileWidget :: PutFile ( Str255 & inTitle, Str255 & inDefaultName, FSSpec* outS
::BlockMoveData(inDefaultName, dialogOptions.savedFileName, *inDefaultName + 1);
// Display the get file dialog
nsWatchTask::GetTask().Suspend();
anErr = ::NavPutFile(
NULL,
&reply,
@ -260,6 +259,7 @@ nsFileWidget :: PutFile ( Str255 & inTitle, Str255 & inDefaultName, FSSpec* outS
typeToSave,
creatorToSave,
NULL); // callbackUD
nsWatchTask::GetTask().Resume();
// See if the user has selected save
if (anErr == noErr && reply.validRecord) {
@ -325,6 +325,7 @@ nsFileWidget :: GetFile ( Str255 & inTitle, /* filter list here later */ FSSpec*
::BlockMoveData(inTitle, dialogOptions.message, *inTitle + 1);
// Display the get file dialog
nsWatchTask::GetTask().Suspend();
anErr = ::NavGetFile(
NULL,
&reply,
@ -334,6 +335,7 @@ nsFileWidget :: GetFile ( Str255 & inTitle, /* filter list here later */ FSSpec*
NULL, // filter proc
NULL, //typeList,
NULL); // callbackUD
nsWatchTask::GetTask().Resume();
// See if the user has selected save
if (anErr == noErr && reply.validRecord) {
@ -393,6 +395,7 @@ nsFileWidget :: GetFolder ( Str255 & inTitle, FSSpec* outSpec )
::BlockMoveData(inTitle, dialogOptions.message, *inTitle + 1);
// Display the get file dialog
nsWatchTask::GetTask().Suspend();
anErr = ::NavChooseFolder(
NULL,
&reply,
@ -400,6 +403,7 @@ nsFileWidget :: GetFolder ( Str255 & inTitle, FSSpec* outSpec )
eventProc,
NULL, // filter proc
NULL); // callbackUD
nsWatchTask::GetTask().Resume();
// See if the user has selected save
if (anErr == noErr && reply.validRecord) {

View File

@ -192,6 +192,9 @@ nsMacMessagePump::nsMacMessagePump(nsToolkit *aToolkit, nsMacMessageSink* aSink)
//
mTSMMessagePump = nsMacTSMMessagePump::GetSingleton();
NS_ASSERTION(mTSMMessagePump!=NULL,"nsMacMessagePump::nsMacMessagePump: Unable to create TSM Message Pump.");
// startup the watch cursor idle time vbl task
nsWatchTask::GetTask().Start();
}
//=================================================================

View File

@ -26,6 +26,8 @@
#include <ControlDefinitions.h>
#endif
#include "nsWatchTask.h"
NS_IMPL_ADDREF(nsScrollbar);
NS_IMPL_RELEASE(nsScrollbar);
@ -206,7 +208,9 @@ PRBool nsScrollbar::DispatchMouseEvent(nsMouseEvent &aEvent)
// which lets you pass the action proc to TrackControl
// for the thumb (this was illegal in previous
// versions of the defproc).
nsWatchTask::GetTask().Suspend();
::TrackControl(mControl, thePoint, sControlActionProc);
nsWatchTask::GetTask().Resume();
// We don't dispatch the mouseDown event because mouseUp is eaten
// by TrackControl anyway and the only messages the app really
// cares about are the NS_SCROLLBAR_xxx messages.