From a37e44c7c5e12995fe8652970b014600d14d1bf0 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 29 Aug 2011 17:52:58 +0000 Subject: [PATCH] failed icon, win32 --- direct/src/plugin_activex/P3DActiveXCtrl.cpp | 12 +++++++----- direct/src/plugin_activex/P3DActiveXCtrl.h | 2 +- direct/src/plugin_npapi/ppInstance.cxx | 11 +++++++---- direct/src/plugin_npapi/ppInstance.h | 2 +- direct/src/plugin_npapi/startup.cxx | 4 ++-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/direct/src/plugin_activex/P3DActiveXCtrl.cpp b/direct/src/plugin_activex/P3DActiveXCtrl.cpp index 3fa7dd9440..046c10c6b4 100644 --- a/direct/src/plugin_activex/P3DActiveXCtrl.cpp +++ b/direct/src/plugin_activex/P3DActiveXCtrl.cpp @@ -234,10 +234,9 @@ void CP3DActiveXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInv return; case S_failed: - // Something went wrong. + // Something went wrong. Go ahead and draw the failed icon. KillTimer(1); - DoSuperclassPaint(pdc, rcBounds); - return; + break; } // 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 // passed, so we don't distract people by drawing it // unnecessarily. - if ((now - _init_time) >= 500) { + if (_state == S_failed || (now - _init_time) >= 500) { 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 // using to paint @@ -590,7 +592,7 @@ get_twirl_bitmaps() { unsigned char twirl_data[twirl_size * 3]; 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, m_instance._fgcolor_r, m_instance._fgcolor_g, m_instance._fgcolor_b, m_instance._bgcolor_r, m_instance._bgcolor_g, m_instance._bgcolor_b); diff --git a/direct/src/plugin_activex/P3DActiveXCtrl.h b/direct/src/plugin_activex/P3DActiveXCtrl.h index d1053ed63c..3af6ac2ce7 100644 --- a/direct/src/plugin_activex/P3DActiveXCtrl.h +++ b/direct/src/plugin_activex/P3DActiveXCtrl.h @@ -99,7 +99,7 @@ protected: CComPtr m_spClientSite; - CBitmap _twirl_bitmaps[twirl_num_steps]; + CBitmap _twirl_bitmaps[twirl_num_steps + 1]; enum State { S_init, // before starting the download diff --git a/direct/src/plugin_npapi/ppInstance.cxx b/direct/src/plugin_npapi/ppInstance.cxx index 7e7ebf7338..8caf814a30 100644 --- a/direct/src/plugin_npapi/ppInstance.cxx +++ b/direct/src/plugin_npapi/ppInstance.cxx @@ -1956,7 +1956,7 @@ cleanup_window() { DeleteObject(_bg_brush); _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) { DeleteObject(_twirl_bitmaps[step]); _twirl_bitmaps[step] = NULL; @@ -2318,7 +2318,7 @@ win_get_twirl_bitmaps() { unsigned char twirl_data[twirl_size * 3]; 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, _fgcolor_r, _fgcolor_g, _fgcolor_b, _bgcolor_r, _bgcolor_g, _bgcolor_b); @@ -2368,14 +2368,17 @@ win_paint_twirl(HWND hwnd, HDC dc) { // Start by painting the background color. FillRect(bdc, &rect, _bg_brush); - if (!_started && !_failed) { + if (!_started) { DWORD now = GetTickCount(); // 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 - _init_time) >= 500) { + if (_failed || (now - _init_time) >= 500) { // Which frame are we drawing? int step = (now / 100) % twirl_num_steps; + if (_failed) { + step = twirl_num_steps; + } HBITMAP twirl = _twirl_bitmaps[step]; diff --git a/direct/src/plugin_npapi/ppInstance.h b/direct/src/plugin_npapi/ppInstance.h index 3a668ae5e0..4708e4d5ca 100644 --- a/direct/src/plugin_npapi/ppInstance.h +++ b/direct/src/plugin_npapi/ppInstance.h @@ -221,7 +221,7 @@ private: #ifdef _WIN32 LONG_PTR _orig_window_proc; HWND _hwnd; - HBITMAP _twirl_bitmaps[twirl_num_steps]; + HBITMAP _twirl_bitmaps[twirl_num_steps + 1]; HBRUSH _bg_brush; DWORD _init_time; #endif // _WIN32 diff --git a/direct/src/plugin_npapi/startup.cxx b/direct/src/plugin_npapi/startup.cxx index 5ec679293f..c80bf9fdcf 100644 --- a/direct/src/plugin_npapi/startup.cxx +++ b/direct/src/plugin_npapi/startup.cxx @@ -576,7 +576,7 @@ NPP_GetValue(NPP instance, NPPVariable variable, void *value) { if (err != NPERR_NO_ERROR) { supports_xembed = false; } - nout << "browser supports_xembed: " << (bool)supports_xembed << "\n"; + nout << "browser supports_xembed: " << (supports_xembed != 0) << "\n"; #ifdef HAVE_GTK bool plugin_supports = true; #else @@ -585,7 +585,7 @@ NPP_GetValue(NPP instance, NPPVariable variable, void *value) { #endif // HAVE_GTK nout << "plugin supports_xembed: " << plugin_supports << "\n"; - inst->set_xembed(supports_xembed); + inst->set_xembed(supports_xembed != 0); *(NPBool *)value = supports_xembed; return NPERR_NO_ERROR;