mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
delay npapi twirl for a half-second too
This commit is contained in:
parent
c63ccdf92a
commit
e1baabdf26
@ -343,6 +343,7 @@ set_window(NPWindow *window) {
|
|||||||
// Also set a timer to go off every once in a while, to update
|
// Also set a timer to go off every once in a while, to update
|
||||||
// the twirling icon, and also to catch events in case something
|
// the twirling icon, and also to catch events in case something
|
||||||
// slips through.
|
// slips through.
|
||||||
|
_init_time = GetTickCount();
|
||||||
SetTimer(_hwnd, 1, 100, NULL);
|
SetTimer(_hwnd, 1, 100, NULL);
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
@ -1731,6 +1732,9 @@ create_instance() {
|
|||||||
}
|
}
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
// In the Windows case, we let the timer keep running, because it
|
||||||
|
// also checks for wayward messages.
|
||||||
|
|
||||||
P3D_token *tokens = NULL;
|
P3D_token *tokens = NULL;
|
||||||
if (!_tokens.empty()) {
|
if (!_tokens.empty()) {
|
||||||
tokens = &_tokens[0];
|
tokens = &_tokens[0];
|
||||||
@ -2322,8 +2326,12 @@ win_paint_twirl(HWND hwnd, HDC dc) {
|
|||||||
FillRect(bdc, &rect, _bg_brush);
|
FillRect(bdc, &rect, _bg_brush);
|
||||||
|
|
||||||
if (!_started && !_failed) {
|
if (!_started && !_failed) {
|
||||||
// Which frame are we drawing?
|
|
||||||
DWORD now = GetTickCount();
|
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) {
|
||||||
|
// Which frame are we drawing?
|
||||||
int step = (now / 100) % twirl_num_steps;
|
int step = (now / 100) % twirl_num_steps;
|
||||||
|
|
||||||
HBITMAP twirl = _twirl_bitmaps[step];
|
HBITMAP twirl = _twirl_bitmaps[step];
|
||||||
@ -2340,6 +2348,7 @@ win_paint_twirl(HWND hwnd, HDC dc) {
|
|||||||
SelectObject(mem_dc, NULL);
|
SelectObject(mem_dc, NULL);
|
||||||
DeleteDC(mem_dc);
|
DeleteDC(mem_dc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now blit the buffer to the window.
|
// Now blit the buffer to the window.
|
||||||
BitBlt(dc, 0, 0, width, height, bdc, 0, 0, SRCCOPY);
|
BitBlt(dc, 0, 0, width, height, bdc, 0, 0, SRCCOPY);
|
||||||
|
@ -221,6 +221,7 @@ private:
|
|||||||
HWND _hwnd;
|
HWND _hwnd;
|
||||||
HBITMAP _twirl_bitmaps[twirl_num_steps];
|
HBITMAP _twirl_bitmaps[twirl_num_steps];
|
||||||
HBRUSH _bg_brush;
|
HBRUSH _bg_brush;
|
||||||
|
DWORD _init_time;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user