Add Refresh() in wxWindowMSW::OnSysColourChanged() (PR #26424)

68 views
Skip to first unread message

Steve Cornett

unread,
May 4, 2026, 10:36:43 AM (10 days ago) May 4
to wx-...@googlegroups.com, Subscribed

Per feedback in #26420, this change adds a Refresh() into wxWindowMSW::OnSysColourChanged() so that all Windows are repainted upon theme change.

This change supersedes #26420. Those changes are no longer needed.


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26424

Commit Summary

  • be84d5e Add Refresh() in wxWindowMSW::OnSysColourChanged()

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424@github.com>

paulcor

unread,
May 4, 2026, 11:25:20 AM (10 days ago) May 4
to wx-...@googlegroups.com, Subscribed
paulcor left a comment (wxWidgets/wxWidgets#26424)

A wxEvent handler can be blocked by a user handler not calling Skip(), I think it would be safer to do it something like the following, although maybe the current code should not be done from EVT_SYS_COLOUR_CHANGED either...

diff --git a/src/msw/window.cpp b/src/msw/window.cpp
index 9632bd1a1c..60fa39aa96 100644
--- a/src/msw/window.cpp
+++ b/src/msw/window.cpp
@@ -3548,6 +3548,8 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
         case WM_SYSCOLORCHANGE:
             // the return value for this message is ignored
             processed = HandleSysColorChange();
+            if (IsTopLevel())
+                Refresh();
             break;
 
         case WM_DISPLAYCHANGE:
@@ -3564,6 +3566,8 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
 
         case WM_SETTINGCHANGE:
             processed = HandleSettingChange(wParam, lParam);
+            if (IsTopLevel())
+                Refresh();
             break;
 
         case WM_QUERYNEWPALETTE:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/c4372277806@github.com>

Steve Cornett

unread,
May 4, 2026, 12:34:17 PM (10 days ago) May 4
to wx-...@googlegroups.com, Push

@stevecor pushed 1 commit.

  • f144c54 Add refresh upon setting change


View it on GitHub or unsubscribe.


Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/before/be84d5ed036c816cb7e5e06488163a8ce9c15d9d/after/f144c54aa359140fb992c156c19c8838aff0b633@github.com>

Steve Cornett

unread,
May 4, 2026, 12:38:28 PM (10 days ago) May 4
to wx-...@googlegroups.com, Subscribed
stevecor left a comment (wxWidgets/wxWidgets#26424)

I find that IsTopLevel() is always false in that context. I added a Refresh() upon WM_SETTINGCHANGE.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/c4372737921@github.com>

VZ

unread,
May 4, 2026, 7:54:03 PM (10 days ago) May 4
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26424)

I don't understand why would IsTopLevel() be always false, but then I don't understand why would we only want to call Refresh() when it's true, isn't the idea to refresh all the windows?

Although thinking more about it, we probably don't need to refresh the standard controls, i.e. those for which IsOfStandardClass() returns true, as those should already refresh themselves correctly — and if they don't, calling Refresh() on them is probably not going to help anyhow.

Also, it looks like in the case which motivated all this, i.e. switching between light and dark modes, we're going to refresh all the windows twice: first from HandleSysColorChange() and then from HandleSettingChange() itself. It's not the end of the world, but it would still be better to avoid this.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/c4375436583@github.com>

paulcor

unread,
May 4, 2026, 8:11:26 PM (10 days ago) May 4
to wx-...@googlegroups.com, Subscribed
paulcor left a comment (wxWidgets/wxWidgets#26424)

but then I don't understand why would we only want to call Refresh() when it's true, isn't the idea to refresh all the windows?

Refresh() documentation says it refreshes all children recursively.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/c4375529838@github.com>

Steve Cornett

unread,
May 5, 2026, 12:06:51 PM (9 days ago) May 5
to wx-...@googlegroups.com, Push

@stevecor pushed 1 commit.

  • 13fdcb3 Minimize calls to Refresh()


View it on GitHub or unsubscribe.


Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/before/f144c54aa359140fb992c156c19c8838aff0b633/after/13fdcb3818394b37a68e484b63d4c91a97a72295@github.com>

Steve Cornett

unread,
May 5, 2026, 12:11:45 PM (9 days ago) May 5
to wx-...@googlegroups.com, Subscribed
stevecor left a comment (wxWidgets/wxWidgets#26424)

After experimenting changing between contrast and dark themes I find we only need to Refresh() upon WM_SETTINGCHANGE. Since Refresh() uses RDW_ALLCHILDREN, we only need to do the top level window.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/c4381011308@github.com>

Steve Cornett

unread,
May 7, 2026, 12:32:59 PM (7 days ago) May 7
to wx-...@googlegroups.com, Push

@stevecor pushed 1 commit.


View it on GitHub or unsubscribe.


Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/before/13fdcb3818394b37a68e484b63d4c91a97a72295/after/b508d8b419301701ccf1893c43518a306fd3182e@github.com>

Steve Cornett

unread,
May 10, 2026, 11:06:26 AM (4 days ago) May 10
to wx-...@googlegroups.com, Push

@stevecor pushed 1 commit.

  • 594a262 Remove a redundant Refresh()


View it on GitHub or unsubscribe.


Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/before/b508d8b419301701ccf1893c43518a306fd3182e/after/594a262adb681d2dfe324927494fc25db5d6fa11@github.com>

Steve Cornett

unread,
May 10, 2026, 11:44:05 AM (4 days ago) May 10
to wx-...@googlegroups.com, Push

@stevecor pushed 1 commit.

  • 89dd456 Remove another redundant Refresh()


View it on GitHub or unsubscribe.


Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/before/594a262adb681d2dfe324927494fc25db5d6fa11/after/89dd45612ff444ec9c0270fc86e328136b9c0b1d@github.com>

Steve Cornett

unread,
May 12, 2026, 12:46:10 PM (2 days ago) May 12
to wx-...@googlegroups.com, Push

@stevecor pushed 1 commit.

  • b34d8d3 Remove redundant Refresh() from wxDataViewCtrl


View it on GitHub or unsubscribe.


Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26424/before/89dd45612ff444ec9c0270fc86e328136b9c0b1d/after/b34d8d32935a6025b0d31b028dee7f9a9b85db34@github.com>

Reply all
Reply to author
Forward
0 new messages