From: Michael Müller michael@fds-team.de
From: Michael Müller michael@fds-team.de Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- programs/taskmgr/graph.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/programs/taskmgr/graph.c b/programs/taskmgr/graph.c index 7e978e16f7a..eb2a4a3ba8e 100644 --- a/programs/taskmgr/graph.c +++ b/programs/taskmgr/graph.c @@ -239,8 +239,10 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) /* Top bars that are "unused", i.e. are dark green, representing free memory */ int i;
- static const WCHAR wszFormat[] = {'%','d','K',0}; - + static const WCHAR wszFormatKB[] = {'%','u',' ','K','B',0}; + static const WCHAR wszFormatMB[] = {'%','u',' ','M','B',0}; + static const WCHAR wszFormatGB[] = {'%','.','1','f',' ','G','B',0}; + /* * Get the client area rectangle */ @@ -257,8 +259,13 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK(); CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
- swprintf(Text, wszFormat, (int)CommitChargeTotal); - + if (CommitChargeTotal > 1048576) + swprintf(Text, wszFormatGB, (float)CommitChargeTotal / 1048576); + else if (CommitChargeTotal > 1024) + swprintf(Text, wszFormatMB, (DWORD)CommitChargeTotal / 1024); + else + swprintf(Text, wszFormatKB, (DWORD)CommitChargeTotal); + /* * Draw the font text onto the graph * The bottom 20 pixels are reserved for the text
On 4/3/19 1:45 PM, Vijay Kiran Kamuju wrote:
- static const WCHAR wszFormat[] = {'%','d','K',0};
- static const WCHAR wszFormatKB[] = {'%','u',' ','K','B',0};
- static const WCHAR wszFormatMB[] = {'%','u',' ','M','B',0};
- static const WCHAR wszFormatGB[] = {'%','.','1','f',' ','G','B',0};
This probably should be localized.
Can anyone tell me how its displayed on Windows for CJK locales or non-english locales? So that I can place these strings in the rc file, for localization.
On Wed, Apr 3, 2019 at 12:49 PM Nikolay Sivov nsivov@codeweavers.com wrote:
On 4/3/19 1:45 PM, Vijay Kiran Kamuju wrote:
- static const WCHAR wszFormat[] = {'%','d','K',0};
- static const WCHAR wszFormatKB[] = {'%','u',' ','K','B',0};
- static const WCHAR wszFormatMB[] = {'%','u',' ','M','B',0};
- static const WCHAR wszFormatGB[] = {'%','.','1','f',' ','G','B',0};
This probably should be localized.
Vijay Kiran Kamuju infyquest@gmail.com writes:
Can anyone tell me how its displayed on Windows for CJK locales or non-english locales? So that I can place these strings in the rc file, for localization.
You probably want StrFormatByteSizeW().