Selaa lähdekoodia

failed icon, win32

David Rose 14 vuotta sitten
vanhempi
sitoutus
a37e44c7c5

+ 7 - 5
direct/src/plugin_activex/P3DActiveXCtrl.cpp

@@ -234,10 +234,9 @@ void CP3DActiveXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInv
       return;
       return;
 
 
     case S_failed:
     case S_failed:
-      // Something went wrong.
+      // Something went wrong.  Go ahead and draw the failed icon.
       KillTimer(1);
       KillTimer(1);
-      DoSuperclassPaint(pdc, rcBounds);
-      return;
+      break;
     }
     }
 
 
     // The instance is setting itself up.  In the meantime, draw the
     // The instance is setting itself up.  In the meantime, draw the
@@ -252,8 +251,11 @@ void CP3DActiveXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInv
     // Don't draw the twirling icon until at least half a second has
     // Don't draw the twirling icon until at least half a second has
     // passed, so we don't distract people by drawing it
     // passed, so we don't distract people by drawing it
     // unnecessarily.
     // unnecessarily.
-    if ((now - _init_time) >= 500) {
+    if (_state == S_failed || (now - _init_time) >= 500) {
       int step = (now / 100) % twirl_num_steps;
       int step = (now / 100) % twirl_num_steps;
+      if (_state == S_failed) {
+        step = twirl_num_steps;
+      }
 
 
       // Create an in-memory DC compatible with the display DC we're
       // Create an in-memory DC compatible with the display DC we're
       // using to paint
       // using to paint
@@ -590,7 +592,7 @@ get_twirl_bitmaps() {
   unsigned char twirl_data[twirl_size * 3];
   unsigned char twirl_data[twirl_size * 3];
   unsigned char new_data[twirl_size * 4];
   unsigned char new_data[twirl_size * 4];
 
 
-  for (int step = 0; step < twirl_num_steps; ++step) {
+  for (int step = 0; step < twirl_num_steps + 1; ++step) {
     get_twirl_data(twirl_data, twirl_size, step,
     get_twirl_data(twirl_data, twirl_size, step,
                    m_instance._fgcolor_r, m_instance._fgcolor_g, m_instance._fgcolor_b, 
                    m_instance._fgcolor_r, m_instance._fgcolor_g, m_instance._fgcolor_b, 
                    m_instance._bgcolor_r, m_instance._bgcolor_g, m_instance._bgcolor_b);
                    m_instance._bgcolor_r, m_instance._bgcolor_g, m_instance._bgcolor_b);

+ 1 - 1
direct/src/plugin_activex/P3DActiveXCtrl.h

@@ -99,7 +99,7 @@ protected:
 
 
     CComPtr<IOleClientSite> m_spClientSite;
     CComPtr<IOleClientSite> m_spClientSite;
 
 
-    CBitmap _twirl_bitmaps[twirl_num_steps];
+    CBitmap _twirl_bitmaps[twirl_num_steps + 1];
 
 
     enum State {
     enum State {
       S_init,     // before starting the download
       S_init,     // before starting the download

+ 7 - 4
direct/src/plugin_npapi/ppInstance.cxx

@@ -1956,7 +1956,7 @@ cleanup_window() {
       DeleteObject(_bg_brush);
       DeleteObject(_bg_brush);
       _bg_brush = NULL;
       _bg_brush = NULL;
     }
     }
-    for (int step = 0; step < twirl_num_steps; ++step) {
+    for (int step = 0; step < twirl_num_steps + 1; ++step) {
       if (_twirl_bitmaps[step] != NULL) {
       if (_twirl_bitmaps[step] != NULL) {
         DeleteObject(_twirl_bitmaps[step]);
         DeleteObject(_twirl_bitmaps[step]);
         _twirl_bitmaps[step] = NULL;
         _twirl_bitmaps[step] = NULL;
@@ -2318,7 +2318,7 @@ win_get_twirl_bitmaps() {
   unsigned char twirl_data[twirl_size * 3];
   unsigned char twirl_data[twirl_size * 3];
   unsigned char new_data[twirl_size * 4];
   unsigned char new_data[twirl_size * 4];
 
 
-  for (int step = 0; step < twirl_num_steps; ++step) {
+  for (int step = 0; step < twirl_num_steps + 1; ++step) {
     get_twirl_data(twirl_data, twirl_size, step,
     get_twirl_data(twirl_data, twirl_size, step,
                    _fgcolor_r, _fgcolor_g, _fgcolor_b, 
                    _fgcolor_r, _fgcolor_g, _fgcolor_b, 
                    _bgcolor_r, _bgcolor_g, _bgcolor_b);
                    _bgcolor_r, _bgcolor_g, _bgcolor_b);
@@ -2368,14 +2368,17 @@ win_paint_twirl(HWND hwnd, HDC dc) {
   // Start by painting the background color.
   // Start by painting the background color.
   FillRect(bdc, &rect, _bg_brush);
   FillRect(bdc, &rect, _bg_brush);
 
 
-  if (!_started && !_failed) {
+  if (!_started) {
     DWORD now = GetTickCount();
     DWORD now = GetTickCount();
     // Don't draw the twirling icon until at least half a second has
     // Don't draw the twirling icon until at least half a second has
     // passed, so we don't distract people by drawing it
     // passed, so we don't distract people by drawing it
     // unnecessarily.
     // unnecessarily.
-    if ((now - _init_time) >= 500) {
+    if (_failed || (now - _init_time) >= 500) {
       // Which frame are we drawing?
       // Which frame are we drawing?
       int step = (now / 100) % twirl_num_steps;
       int step = (now / 100) % twirl_num_steps;
+      if (_failed) {
+        step = twirl_num_steps;
+      }
       
       
       HBITMAP twirl = _twirl_bitmaps[step];
       HBITMAP twirl = _twirl_bitmaps[step];
       
       

+ 1 - 1
direct/src/plugin_npapi/ppInstance.h

@@ -221,7 +221,7 @@ private:
 #ifdef _WIN32
 #ifdef _WIN32
   LONG_PTR _orig_window_proc;
   LONG_PTR _orig_window_proc;
   HWND _hwnd;
   HWND _hwnd;
-  HBITMAP _twirl_bitmaps[twirl_num_steps];
+  HBITMAP _twirl_bitmaps[twirl_num_steps + 1];
   HBRUSH _bg_brush;
   HBRUSH _bg_brush;
   DWORD _init_time;
   DWORD _init_time;
 #endif  // _WIN32
 #endif  // _WIN32

+ 2 - 2
direct/src/plugin_npapi/startup.cxx

@@ -576,7 +576,7 @@ NPP_GetValue(NPP instance, NPPVariable variable, void *value) {
     if (err != NPERR_NO_ERROR) {
     if (err != NPERR_NO_ERROR) {
       supports_xembed = false;
       supports_xembed = false;
     }
     }
-    nout << "browser supports_xembed: " << (bool)supports_xembed << "\n";
+    nout << "browser supports_xembed: " << (supports_xembed != 0) << "\n";
 #ifdef HAVE_GTK
 #ifdef HAVE_GTK
     bool plugin_supports = true;
     bool plugin_supports = true;
 #else
 #else
@@ -585,7 +585,7 @@ NPP_GetValue(NPP instance, NPPVariable variable, void *value) {
 #endif  // HAVE_GTK
 #endif  // HAVE_GTK
     nout << "plugin supports_xembed: " << plugin_supports << "\n";
     nout << "plugin supports_xembed: " << plugin_supports << "\n";
 
 
-    inst->set_xembed(supports_xembed);
+    inst->set_xembed(supports_xembed != 0);
     *(NPBool *)value = supports_xembed;
     *(NPBool *)value = supports_xembed;
 
 
     return NPERR_NO_ERROR;
     return NPERR_NO_ERROR;