From 7f0533fc9ae5d234f90afcb79c8377e3b1e4ede7 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 1 Dec 2021 20:35:29 +0100 Subject: [PATCH 1/2] Ignore status bar icon timer callback if the status bar has reset itself in between. --- src/win/win_stbar.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index c980253e0..e9c2028ad 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -60,7 +60,7 @@ HWND hwndSBAR; -int update_icons = 1; +int update_icons = 1, reset_occurred = 1; static LONG_PTR OriginalProcedure; @@ -122,12 +122,15 @@ hdd_count(int bus) void ui_sb_timer_callback(int pane) { - sb_part_icons[pane] &= ~1; + if (!(reset_occurred & 1)) { + sb_part_icons[pane] &= ~1; - if (sb_part_icons && sb_part_icons[pane]) { - SendMessage(hwndSBAR, SB_SETICON, pane, - (LPARAM)hIcon[sb_part_icons[pane]]); - } + if (sb_part_icons && sb_part_icons[pane]) { + SendMessage(hwndSBAR, SB_SETICON, pane, + (LPARAM)hIcon[sb_part_icons[pane]]); + } + } else + reset_occurred &= ~1; } @@ -152,6 +155,7 @@ ui_sb_update_icon(int tag, int active) PostMessage(hwndSBAR, SB_SETICON, found, (LPARAM)hIcon[sb_part_icons[found]]); + reset_occurred = 2; SetTimer(hwndMain, 0x8000 | found, 75, NULL); } } @@ -832,6 +836,8 @@ ui_sb_update_panes(void) } sb_ready = 1; + if (reset_occurred & 2) + reset_occurred |= 1; } From 8fb29ad031d5a65ddf8b6dc00c180f1372d66401 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 1 Dec 2021 21:06:50 +0100 Subject: [PATCH 2/2] Unfudged the status bar fix. --- src/win/win_stbar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index e9c2028ad..17178a6bf 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -131,6 +131,8 @@ ui_sb_timer_callback(int pane) } } else reset_occurred &= ~1; + + reset_occurred &= ~2; }