[misc] refactor the "operation in progress" detection

* Remove unused iso_op_in_progress and use a single op_in_progress that gets
  set when we disable the controls.
* Also fix an issue where Ctrl-L was being processed as Alt-L due yet another
  completely backwards Windows behaviour where the message that is meant to
  indicating whether Alt is pressed is also sometimes used to indicate that
  another key is being pressed if the dialog doesn't have keyboard focus...
This commit is contained in:
Pete Batard 2019-08-22 14:04:41 +01:00
parent af95de8198
commit 21351b9fbe
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
5 changed files with 303 additions and 310 deletions

View file

@ -695,29 +695,6 @@ char* TimestampToHumanReadable(uint64_t ts)
return str;
}
// TODO: Add granularity
char* RateToHumanReadable(uint64_t transferred, uint64_t total)
{
const uint64_t refresh_rate = 1000;
static uint64_t start_time, last_refresh = 0;
uint64_t current_time, rate;
if (total == 0) {
// init
start_time = GetTickCount64();
last_refresh = start_time;
} else {
current_time = GetTickCount64();
if (current_time <= start_time)
return NULL;
rate = (transferred * 1000) / (current_time - start_time);
if (current_time > last_refresh + refresh_rate) {
last_refresh = current_time;
uprintf("%s/s", SizeToHumanReadable(rate, FALSE, FALSE));
}
}
return NULL;
}
// Convert custom error code to messages
const char* _StrError(DWORD error_code)
{