diff --git a/direct/src/plugin/p3d_lock.h b/direct/src/plugin/p3d_lock.h index 915bf06fe6..6e65447af3 100755 --- a/direct/src/plugin/p3d_lock.h +++ b/direct/src/plugin/p3d_lock.h @@ -81,7 +81,7 @@ public: pthread_mutexattr_t attr; \ pthread_mutexattr_init(&attr); \ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); \ - int result = pthread_mutex_init(&(lock), &attr); \ + pthread_mutex_init(&(lock), &attr); \ pthread_mutexattr_destroy(&attr); \ } #define ACQUIRE_LOCK(lock) pthread_mutex_lock(&(lock)) diff --git a/direct/src/plugin/p3d_plugin_config.h.pp b/direct/src/plugin/p3d_plugin_config.h.pp index 669709db63..2deedc8172 100644 --- a/direct/src/plugin/p3d_plugin_config.h.pp +++ b/direct/src/plugin/p3d_plugin_config.h.pp @@ -14,6 +14,9 @@ pandaVersion.h. */ #$[]define P3D_COREAPI_VERSION_STR "$[join .,$[P3D_COREAPI_VERSION]]" +/* As does the plugin version number. */ +#$[]define P3D_PLUGIN_VERSION_STR "$[join .,$[P3D_PLUGIN_VERSION]]" + /* The filename(s) to generate output to when the plugin is running. For debugging purposes only. */ #$[]define P3D_PLUGIN_LOG_DIRECTORY "$[subst \,\\,$[osfilename $[P3D_PLUGIN_LOG_DIRECTORY]]]" diff --git a/direct/src/plugin_npapi/ppInstance.cxx b/direct/src/plugin_npapi/ppInstance.cxx index a5bfaf7785..4155c05ca3 100644 --- a/direct/src/plugin_npapi/ppInstance.cxx +++ b/direct/src/plugin_npapi/ppInstance.cxx @@ -135,10 +135,13 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16_t mode, #endif // _WIN32 #ifndef _WIN32 - // Save the startup time to improve precision of gettimeofday(). + // Save the startup time to improve precision of gettimeofday(). We + // also use this to measure elapsed time from the window parameters + // having been received. struct timeval tv; gettimeofday(&tv, (struct timezone *)NULL); _init_sec = tv.tv_sec; + _init_usec = tv.tv_usec; #endif // !_WIN32 #ifdef __APPLE__ @@ -2642,10 +2645,15 @@ paint_twirl_osx_cgcontext(CGContextRef context) { struct timeval tv; gettimeofday(&tv, (struct timezone *)NULL); - double now = (double)(tv.tv_sec - _init_sec) + (double)tv.tv_usec / 1000000.0; - int step = ((int)(now * 10.0)) % twirl_num_steps; + double now = (double)(tv.tv_sec - _init_sec) + (double)(tv.tv_usec - _init_usec) / 1000000.0; - osx_paint_image(context, _twirl_images[step]); + // Don't draw the twirling icon until at least half a second has + // passed, so we don't distract people by drawing it + // unnecessarily. + if (now >= 0.5) { + int step = ((int)(now * 10.0)) % twirl_num_steps; + osx_paint_image(context, _twirl_images[step]); + } } #endif // MACOSX_HAS_EVENT_MODELS diff --git a/direct/src/plugin_npapi/ppInstance.h b/direct/src/plugin_npapi/ppInstance.h index f7f01020f7..ef644b0a4e 100644 --- a/direct/src/plugin_npapi/ppInstance.h +++ b/direct/src/plugin_npapi/ppInstance.h @@ -246,6 +246,7 @@ private: #ifndef _WIN32 long _init_sec; + long _init_usec; #endif // _WIN32 bool _python_window_open; diff --git a/direct/src/plugin_npapi/startup.cxx b/direct/src/plugin_npapi/startup.cxx index 84496b0617..134eb89c1d 100644 --- a/direct/src/plugin_npapi/startup.cxx +++ b/direct/src/plugin_npapi/startup.cxx @@ -163,7 +163,7 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs, // open_logfile() also assigns global_root_dir. open_logfile(); - nout << "initializing\n"; + nout << "Initializing Panda3D plugin version " << P3D_PLUGIN_VERSION_STR << "\n"; nout << "browserFuncs = " << browserFuncs << "\n"; @@ -177,12 +177,12 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs, int browser_major = (browser->version >> 8) && 0xff; int browser_minor = browser->version & 0xff; - nout << "Browser version " << browser_major << "." << browser_minor << "\n"; + nout << "Browser NPAPI version " << browser_major << "." << browser_minor << "\n"; int expected_major = NP_VERSION_MAJOR; int expected_minor = NP_VERSION_MINOR; - nout << "Plugin compiled with version " + nout << "Plugin compiled with NPAPI version " << expected_major << "." << expected_minor << "\n"; has_plugin_thread_async_call = false;