Garbled text in editorcontrol in Dark mode

16 views
Skip to first unread message

Daniel Sahlberg

unread,
Nov 14, 2024, 3:41:51 PM11/14/24
to TortoiseSVN-dev
Hi,

I've been looking at the report in the users group about garbled text in the edit property value dialog [1].

I can reproduce it (under Windows 11 running in Hyper-V) if I use dark mode.

A (stupid!) solution would be to invalidate the whole edit control in CEditPropertyValueDlg::OnEnChangePropvalue(). Surely there must be a better solution..?

[[[
    CRect rect;
    CWnd* pWnd = GetDlgItem(IDC_PROPVALUE);
    pWnd->GetWindowRect(&rect);
    ScreenToClient(&rect);
    InvalidateRect(&rect, TRUE);
]]]

(It works but causes a bit of flickering).

Kind regards,
Daniel


Stefan

unread,
Nov 14, 2024, 4:42:13 PM11/14/24
to TortoiseSVN-dev

I can reproduce it (under Windows 11 running in Hyper-V) if I use dark mode.

A (stupid!) solution would be to invalidate the whole edit control in CEditPropertyValueDlg::OnEnChangePropvalue(). Surely there must be a better solution..?

[[[
    CRect rect;
    CWnd* pWnd = GetDlgItem(IDC_PROPVALUE);
    pWnd->GetWindowRect(&rect);
    ScreenToClient(&rect);
    InvalidateRect(&rect, TRUE);
]]]

why not just use
GetDlgItem(IDC_PROPVALUE)->Invalidate();

maybe there's something we could do differently in CTheme::MainSubclassProc ? I can't reproduce this here, not even in a VM. So I won't be of much help :(
 

Daniel Sahlberg

unread,
Nov 15, 2024, 4:27:40 AM11/15/24
to TortoiseSVN-dev
torsdag 14 november 2024 kl. 22:42:13 UTC+1 skrev Stefan:

I can reproduce it (under Windows 11 running in Hyper-V) if I use dark mode.

A (stupid!) solution would be to invalidate the whole edit control in CEditPropertyValueDlg::OnEnChangePropvalue(). Surely there must be a better solution..?

[[[
    CRect rect;
    CWnd* pWnd = GetDlgItem(IDC_PROPVALUE);
    pWnd->GetWindowRect(&rect);
    ScreenToClient(&rect);
    InvalidateRect(&rect, TRUE);
]]]

why not just use
GetDlgItem(IDC_PROPVALUE)->Invalidate();

Thanks! This is far from my comfort zone so I don't know of all the APIs.

Unfortunately this (and my code - I'm assuming they are essentially the same) causes flickering of the text box, in particular on edit. We could of course do it only if dark mode, but still if the garbled text only affects some users, and the Invalidate() flickering affects everyone, I'm not sure if it is a good solution.

It would be good if it is possible to invalidate just the changed line of text.
 
maybe there's something we could do differently in CTheme::MainSubclassProc ? I can't reproduce this here, not even in a VM. So I won't be of much help :(

I'll have a look to see if I can figure out the difference between dark mode and non-dark mode. Unfortunately I'm out of time for now so I'll have this on my todo list.

Kind regards,
Daniel

Stefan

unread,
Nov 15, 2024, 3:25:44 PM11/15/24
to TortoiseSVN-dev
I've committed a possible fix. Not sure if it does fix the problem or whether it could cause other problems instead. But it's a good bet I think.

Daniel Sahlberg

unread,
Nov 15, 2024, 4:29:04 PM11/15/24
to TortoiseSVN-dev
fredag 15 november 2024 kl. 21:25:44 UTC+1 skrev Stefan:
I've committed a possible fix. Not sure if it does fix the problem or whether it could cause other problems instead. But it's a good bet I think.

Thanks, solved the problem for me - tested before and after "svn up" and the fix made all the difference.

Cheers,
Daniel
Reply all
Reply to author
Forward
0 new messages