Experimental support for dark mode for wxMSW (PR #23028)

1,403 views
Skip to first unread message

VZ

unread,
Dec 10, 2022, 7:53:45 PM12/10/22
to wx-...@googlegroups.com, Subscribed

This is not complete yet, but it's already doing something (note that you need to enable it explicitly to test, the simplest way to do it is by setting WX_MSW_DARK_MODE=2 in the environment).

The most glaring missing piece (at least among those that I've seen, maybe there is something even worse) is support for dark scrollbars. Support for this in some other projects is achieved by hooking OpenNcThemeData() function and forcing it to use Explorer::ScrollBar instead of ScrollBar, but doing this requires mucking with IAT and doesn't seem very robust, so I'm not really sure what to do about it yet. We could add an option to opt-in into doing this, but this looks like a cop out rather than a real solution.

Anyhow, testing this is already welcome, even if, to return to the beginning, many things don't work yet.


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

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

Commit Summary

  • bcea384 Start adding dark mode support to wxMSW
  • 9b24fda Use dark title bar for top level windows in dark mode
  • 1b47a34 Refactor code to use ShouldUseDarkMode()
  • 43c41b0 Enable using dark mode for native controls
  • 42182d0 Use dark Explorer theme for the dialog gripper
  • 2216382 Adapt wxToolTip colours to dark mode
  • 16507b5 Make message box title bar dark when using dark mode
  • 8de0982 Add msw.dark-mode system option to allow turning it on easily
  • 8e5d83f Add wxMSWDarkMode::IsActive()
  • 1ec876d Add support for using custom theme class in dark mode
  • 053faf2 Support dark mode for windows and dialogs backgrounds
  • ebc32b0 Document wxMessageBox dark mode limitation
  • 77ab73a Add MSWShouldUseAutoDarkMode() and use it for wxSpinButton
  • c820381 Make wxUxThemeHandle::m_hTheme const
  • 190f158 Allow constructing wxUxThemeHandle from an HWND too
  • 1dbe402 Allow customizing both dark theme name and ID
  • 7d4949b Enable dark mode support for wxListCtrl
  • 683fded Apply dark mode to the tooltips of the native controls using them
  • 9040ec0 Reuse wxMSWHeaderCtrlCustomDraw in wxListCtrl too
  • f65951b Add wxUxThemeHandle::GetColour() replacing MSWGetThemeColour()
  • cccf650 Add dark mode support to wxHeaderCtrl
  • 0f0d782 Rename WindowHDC private helper class to ClientHDC
  • db77396 Add WindowHDC RAII helper class
  • fbd142a Add wxMapWindowPoints() private helper function
  • 3952ff3 Use custom draw for the menu bar in dark mode

File Changes

(46 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028@github.com>

VZ

unread,
Dec 14, 2022, 6:56:21 PM12/14/22
to wx-...@googlegroups.com, Push

@vadz pushed 7 commits.

  • a679586 fixup! Add msw.dark-mode system option to allow turning it on easily
  • 8a940bf fixup! Use dark title bar for top level windows in dark mode
  • 6587c97 Use the same background for windows and frames in dark mode
  • 8b8e4a4 Document that date/time picker controls don't support dark mode
  • c6dbf94 Make wxActivityIndicator visible when using dark mode
  • 517027d Replace a pair of functions with single MSWGetDarkModeSupport()
  • 188f465 Fix static box and check/radio buttons text colour in dark mode


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12001793816@github.com>

VZ

unread,
Dec 14, 2022, 7:01:09 PM12/14/22
to wx-...@googlegroups.com, Subscribed

It seems to be simply impossible to customize appearance of some native controls, e.g. date/time pickers don't seem to allow doing it in any way and using MSWShouldUseAutoDarkMode() hack for them is just too ugly -- even using the generic versions would be better.

The radio box buttons are also using black text on dark background right now, but this can be fixed by just (finally) rewriting wxRadioBox to use wxRadioButtons inside it instead of using the native buttons directly and I plan to do it.

There are certainly other problems in addition to these ones, but it could still be already interesting to test this branch with the real applications. Please let me know if anybody does it!


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 14, 2022, 7:25:29 PM12/14/22
to wx-...@googlegroups.com, Push

@vadz pushed 1 commit.

  • 0d9587d fixup! Fix static box and check/radio buttons text colour in dark mode


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12001976321@github.com>

Scott Hanson

unread,
Dec 15, 2022, 11:49:54 AM12/15/22
to wx-...@googlegroups.com, Subscribed

I started testing the dark mode code on the xLights project, The AUI controls don't change to dark mode in my testing. Any ideas how to fix this. Thanks for all your hard work.

image


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 15, 2022, 12:18:24 PM12/15/22
to wx-...@googlegroups.com, Subscribed

Thanks for testing and I should have mentioned that this part is only about the native Windows controls (and some generic ones, such as wxActivityIndicator). I still need to do it for wxAUI and wxSTC too. Hopefully I'll be able to do it soon, but I haven't done it yet.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey К.

unread,
Dec 15, 2022, 2:29:30 PM12/15/22
to wx-dev
My 5 cents:

1. wxNotebook have default (light) tabs. Background also default (light) colors, but temporary solved by setting background color:  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).

2. wxChoice have default (light) background.

3. wxTreeListCtrl and others controls have default (light) scrollbars, but OTOH wxTreeCtrl have  scrollbars  with proper (dark) colors. Also expanding arrows in wxTreeListCtrl uses default black colors on dark background (should be light arrows).

4. wxDataViewListCtrl have default (light) alternate row (wxDV_ROW_LINES) colors. Solved by SetAlternateRowColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).ChangeLightness(80)), it's hardcoded alpha component but for me looks Ok.

5. Border colors and wxStaticLine should be darkened also (at this time by default uses white colors)

6. Resizable border in Dialogs or frames with wxRESIZE_BORDER looks strange for me.

In any way thanks you Vadim to implementing this (long awaited) feature.

четверг, 15 декабря 2022 г. в 21:18:24 UTC+4, VZ:

Eran Ifrah

unread,
Dec 20, 2022, 3:58:29 AM12/20/22
to wx-...@googlegroups.com, Subscribed

Hi, I tried using this branch and enabled wxSystemOptions::SetOption("msw.dark-mode", 2); in the dataview.cpp sample file.
No apparent change, what am I missing?

diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp
index 67314a3251..25389e8f28 100644
--- a/samples/dataview/dataview.cpp
+++ b/samples/dataview/dataview.cpp
@@ -32,6 +32,7 @@
 #include "wx/imaglist.h"
 #include "wx/itemattr.h"
 #include "wx/notebook.h"
+#include "wx/sysopt.h"

 #ifdef wxHAS_GENERIC_DATAVIEWCTRL
     #include "wx/headerctrl.h"
@@ -380,6 +381,7 @@ wxIMPLEMENT_APP(MyApp);

 bool MyApp::OnInit()
 {
+    wxSystemOptions::SetOption("msw.dark-mode", 2);
     if ( !wxApp::OnInit() )
         return false;


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 20, 2022, 4:49:21 PM12/20/22
to wx-...@googlegroups.com, Subscribed

Calling this option here is too late, but then this mechanism is mostly meant to be used to force the dark mode from outside of the program, if you want to enable it programmatically, just call MSWEnableDarkMode() directly.

Also notice that there is a known problem with the wxDVC selection colour in dark mode that I'll fix soon.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Vadim Zeitlin

unread,
Dec 20, 2022, 9:43:24 PM12/20/22
to wx-...@googlegroups.com
On Thu, 15 Dec 2022 11:14:29 -0800 (PST) Sergey К. wrote:

SК> My 5 cents:

Thanks for testing and sorry for the delay with replying! In fact, I still
haven't had time to deal with most of the issues you've found, but wanted
to answer just to let you know that I was still working on them.

SК> 1. wxNotebook have default (light) tabs. Background also default (light)
SК> colors, but temporary solved by setting background color:
SК> SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).

After spending quite some time on this, it doesn't look like there is any
way to have dark notebooks with the standard control, so we'll just have to
draw everything ourselves. It's not that difficult, except that I have no
idea how is it even supposed to look like because there doesn't seem to be
any standard dark tab control look and, of course, it risks looking out of
date on the next Windows version when it comes out (for all I know maybe it
already looks out of date under Windows 11 because I don't have it yet).

Oh, and there is also the (light) spin control used when there are too
many pages that I for now just invert in the same way it's done with
wxSpinButton, but this really doesn't look very good.

SК> 2. wxChoice have default (light) background.

Here we're in luck, there is "CFD" (does anybody have any idea about what
does it mean?) theme which makes them dark, so I've fixed this.

SК> 3. wxTreeListCtrl and others controls have default (light) scrollbars, but
SК> OTOH wxTreeCtrl have scrollbars with proper (dark) colors. Also expanding
SК> arrows in wxTreeListCtrl uses default black colors on dark background
SК> (should be light arrows).

Scrollbars are the worst problem, we need to hook into a system DLL in
order to make them dark. I'm still not sure if it's worth it, this looks
like an even dirtier hack than anything we do so far -- but I'm more or
less certain that it's the only way to do it.

SК> 4. wxDataViewListCtrl have default (light) alternate row (wxDV_ROW_LINES)
SК> colors. Solved by
SК> SetAlternateRowColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).ChangeLightness(80)),
SК> it's hardcoded alpha component but for me looks Ok.

We'll need to do something like this, yes, thanks.

SК> 5. Border colors and wxStaticLine should be darkened also (at this time by
SК> default uses white colors)

To be honest I think this is fine, at least for now.

SК> 6. Resizable border in Dialogs or frames with wxRESIZE_BORDER looks strange
SК> for me.

Hmm, I don't see anything obviously wrong here, what exactly do you think
is strange here?

SК> In any way thanks you Vadim to implementing this (long awaited) feature.

I know that many people want to have support for it, but it's very, very
painful and goes against the whole idea of wxWidgets, which is to provide
an abstraction for the native look and feel because there is just no native
look for the dark mode for many controls (and dialogs etc). I'll finish it
and we'll see how it works but I really wish Microsoft made our life easier
here by providing official support for the dark mode in the API.

Thanks again for testing!
VZ

Eran Ifrah

unread,
Dec 21, 2022, 2:54:16 AM12/21/22
to wx-...@googlegroups.com, Subscribed

Thanks - I was able to get it to work.

Major problem (IMO)

  • The Dark mode ON and OFF can not be done without restarting the program. My current implementation (Many of the controls I am using are custom drawn) allows for switching between dark/light modes without restart required based on the editor (wxSTC based control) selected theme

Observations

  • wxToolBar (while in a wxDialog) shows black text over a dark background - which makes it unreadable. The hover background colour can not be seen as well
  • Anything within a wxNotebook inherits its light background, while the text foreground is using light colour as well, as a result, most of the controls looks "disabled" (see below screenshots)
  • wxFontPicker button shows black colour over black background
  • nit: The checkbox are too light while using the dark mode
  • wxSTC are not using dark mode scrollbars -> in my current code, I have managed to get it calling recursively (see code example below)
  • wxDialog resize bitmap does not fit well with the dark mode colours
  • Many controls border are too shiny (too white) - which produce a high contrast colours
  • wxStaticLine colour is too shiny as well (screenshot below)
m_pfnAllowDarkModeForWindow(w->GetHandle(), use_dark);
SetWindowTheme(w->GetHandle(), use_dark ? L"DarkMode_Explorer" : L"Explorer", nullptr);

Below code is the current code (before your effort for Dark Mode) that I have been using until now and it also
fixes dark scrollbars:

        // bfs the windows
        std::vector<wxWindow*> Q;
        std::unordered_set<wxWindow*> V; // visited
        Q.push_back(win);
        while(!Q.empty()) {
            wxWindow* w = Q.front();
            Q.erase(Q.begin());

            if(!V.insert(w).second) {
                // already visited this window (how can this be true??)
                continue;
            }

            BOOL use_dark = current_theme_is_dark ? TRUE : FALSE;
            if(dynamic_cast<wxTextCtrl*>(w)) {
                use_dark = FALSE; // don't allow dark mode for text controls
            }

            m_pfnAllowDarkModeForWindow(w->GetHandle(), use_dark);
            SetWindowTheme(w->GetHandle(), use_dark ? L"DarkMode_Explorer" : L"Explorer", nullptr);

            if(m_pfnFlushMenuThemes) {
                m_pfnFlushMenuThemes();
            }

            InvalidateRect(w->GetHandle(), nullptr, FALSE); // HACK
            const auto& children = w->GetChildren();
            for(auto c : children) {
                Q.push_back(c);
            }
        }

Some screenshots to demonstrate most of the problems I mentioned (I have many dialogs in CodeLite, I can post more):

dark-mode-1
dark-mode-2
dark-mode-3


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 21, 2022, 3:33:12 PM12/21/22
to wx-...@googlegroups.com, Subscribed

Thanks a lot for testing, but we probably need to create separate issues for the specific problems as there are so many of them already (here and in another reply which didn't get copied here) that some of them risk getting lost anyhow.

Right now I'm still fixing wxNotebook, which is painful because apparently I have to draw it entirely on my own to achieve the dark look, but I'm especially interested in the scrollbar part: how exactly did you manage to make this work? Is just setting "DarkMode_Explorer" theme enough? I'm almost sure I've tried doing this and it didn't work, but perhaps I made some mistake, so I'll try again once I finish with the notebook. I'm really confused by how themes work with AllowDarkModeForWindow(), mostly I don't see any difference between using "DarkMode_Explorer" and "Explorer"...


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 21, 2022, 7:22:33 PM12/21/22
to wx-...@googlegroups.com, Subscribed

@eranif Specifically concerning wxStaticLine, I can confirm that I don't see any difference between using "DarkMode_Explorer" and "Explorer" theme, i.e. it's still white (0xffffff) for me with the former theme. I guess we could owner-draw it to make it of the expected colour (0xe0e0e0 I'd guess?), but I still don't understand why does it work differently for you.

I'm testing under 10.0.19043.2251, what is your OS version?


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Eran Ifrah

unread,
Dec 22, 2022, 2:15:09 AM12/22/22
to wx-...@googlegroups.com, Subscribed

I will try and make some changes to the dataview demo and see what I can come up with


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Eran Ifrah

unread,
Dec 22, 2022, 2:44:25 AM12/22/22
to wx-...@googlegroups.com, Subscribed

Turns out that another call to AllowDarkModeForWindow was missing. I thought that you are already doing this internally so I am not sure why the extra call is needed.

Patch:
dataview.patch

By adding a call to AllowDarkModeForWindow for every wxDataViewCtrl we have in the sample, gives us dark scrollbars.

Without the patch:
normal-scrollbars

With the extra call:

dark-scrollbars


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Eran Ifrah

unread,
Dec 22, 2022, 3:03:01 AM12/22/22
to wx-...@googlegroups.com, Subscribed

I did some more digging and I wanted to fix the following:

  • Tree buttons are not visible in dark mode
  • Text selection is still behaving like it is a "light themed" control

So what I did is:

  • Call SetWindowTheme(win->GetHWND(), useDarkMode ? L"DarkMode_Explorer" : L"Explorer", nullptr); recursively on all the children of the wxDataViewCtrl
  • This fixes the problem with one caveat: wxHeaderCtrlBase does not play nice with DarkMode_Explorer - so I excluded it to get a perfect wxDataViewCtrl

even-better

The patch:
dataview.patch


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 22, 2022, 11:18:59 AM12/22/22
to wx-...@googlegroups.com, Subscribed

Sorry, the scrollbars for our own windows can indeed be made dark by just allowing the use of dark mode for them and setting "Explorer" theme ("DarkMode_Explorer" works too, but I still don't see any difference with it compared to "Explorer" and I think that using "Explorer" might be a tad more reliable, i.e. less likely to get broken in some future version of Windows). It's just the scrollbars of the LISTVIEW that are problematic because if we use "Explorer" for it, it uses wrong selection colour, see the comment in wxListCtrl::MSWGetDarkModeSupport().


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 22, 2022, 10:00:17 PM12/22/22
to wx-...@googlegroups.com, Push

@vadz pushed 11 commits.

  • 026f676 Remove unneeded headers inclusion from src/msw/notebook.cpp
  • 7c0744c Use proper theme for dark mode support in wxChoice and wxComboBox
  • c626c79 Start implementing our own wxNotebook drawing in dark mode
  • f6ef55f Enable using dark scrollbars for all windows
  • 01618bf fixup! Start implementing our own wxNotebook drawing in dark mode
  • 458a940 Define wxSYS_COLOUR_BTNSHADOW and HOTLIGHT for dark mode too
  • 12f3264 Paint wxNotebook tabs in all directions in dark mode
  • 7126cfc Use theme-appropriate default colour in wxFontPickerCtrl
  • c2113e3 Improve wxToolBar appearance in dark mode
  • a6c98c2 Allow using wxMSWDarkMode::PaintIfNecessary() with any HWND
  • 800bd4c Invert the spin control used by wxNotebook in dark mode


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12084898349@github.com>

VZ

unread,
Dec 22, 2022, 10:01:50 PM12/22/22
to wx-...@googlegroups.com, Subscribed

I've pushed the latest round of changes. There are still many problems remaining, but I think we should merge what we have already, unless somebody really objects to it, and open separate issues/PRs for the other issues as there are definitely still going to be many of them and we'll never merge this if we wait until everything is fixed.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

k-serg

unread,
Dec 23, 2022, 12:23:33 PM12/23/22
to wx-...@googlegroups.com, Subscribed

I've pushed the latest round of changes. There are still many problems remaining, but I think we should merge what we have already, unless somebody really objects to it, and open separate issues/PRs for the other issues as there are definitely still going to be many of them and we'll never merge this if we wait until everything is fixed.

wxStaticBoxSizer inside wxStaticBoxSizer in dark mode not visible at all.

Image 2022-12-23 21 19 55
Image 2022-12-23 21 19 11


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 23, 2022, 6:59:57 PM12/23/22
to wx-...@googlegroups.com, Subscribed

@k-serg I can't reproduce this with the following code in the minimal sample:

    auto p = new wxPanel(this);
    auto* s = new wxStaticBoxSizer(wxHORIZONTAL, p, "&Outer");
    auto* s2 = new wxStaticBoxSizer(wxVERTICAL, s->GetStaticBox(), "&Inner");
    s2->Add(new wxCheckBox(s2->GetStaticBox(), wxID_ANY, "&Check me"));
    s->Add(s2);
    p->SetSizer(s);

I've tried using the panel because I couldn't reproduce it without it neither, i.e. if you remove p and use this instead of it, everything still looks fine here.

Could you please provide a minimal patch to the minimal sample allowing to reproduce the above? TIA!


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Eran Ifrah

unread,
Dec 24, 2022, 5:38:28 AM12/24/22
to wx-...@googlegroups.com, Subscribed

I think its a good idea to push the current state into master. Once merged, I can perform more checks and report back


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 24, 2022, 8:48:25 AM12/24/22
to wx-...@googlegroups.com, Subscribed

@k-serg I can't reproduce this with the following code in the minimal sample:

    auto p = new wxPanel(this);
    auto* s = new wxStaticBoxSizer(wxHORIZONTAL, p, "&Outer");
    auto* s2 = new wxStaticBoxSizer(wxVERTICAL, s->GetStaticBox(), "&Inner");
    s2->Add(new wxCheckBox(s2->GetStaticBox(), wxID_ANY, "&Check me"));
    s->Add(s2);
    p->SetSizer(s);

I've tried using the panel because I couldn't reproduce it without it neither, i.e. if you remove p and use this instead of it, everything still looks fine here.

Could you please provide a minimal patch to the minimal sample allowing to reproduce the above? TIA!

Just standart widgets.exe from \samples\widgets without any changes from my part:

Image 2022-12-24 17 36 03
Image 2022-12-24 17 35 39

Also I've found thats some scrollbar again not using dark mode: widgets from \samples\widgets

Scrollbar


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 24, 2022, 9:18:09 AM12/24/22
to wx-...@googlegroups.com, Subscribed

And from our previous mailing list conversation:

https://groups.google.com/g/wx-dev/c/ZkiLFd0zhKc/m/RpOktT6cAwAJ

Resizable border in Dialogs or frames with wxRESIZE_BORDER looks strange

Hmm, I don't see anything obviously wrong here, what exactly do you think
is strange here?

Please take a look at the color of resizeble (dotted) area. I'ts not a really big problem, but anyway.
Resize_

minimal from \samples\widgets without changes:

Image 2022-12-24 18 12 58

Check it please, maybe this is from my part.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 24, 2022, 11:47:41 AM12/24/22
to wx-...@googlegroups.com, Subscribed

The trouble is that we create a scrollbar control (with SBS_SIZEGRIP style) ourselves for the dialog, while for the frame we just use the standard status bar which does what it does in dark mode (enabled by using "ExplorerStatusBar" for it) and even though they both seem to work on their own, they are inconsistent.

I also have no idea how is the gripper supposed to look like in dark mode. Explorer itself doesn't use it and I couldn't find any other dark mode application with it.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Eran Ifrah

unread,
Dec 24, 2022, 11:56:35 AM12/24/22
to wx-...@googlegroups.com, Subscribed

I would vote for not having a gripper at all if you can not find a suitable dark one
On other platforms, there is no gripper... (and in most Windows native frames)


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 24, 2022, 12:09:20 PM12/24/22
to wx-...@googlegroups.com, Subscribed

It's a style, so if you don't want to use it you already can -- just don't specify wxSTB_SIZEGRIP, but it's a bit weird not to use it if this style is given. Maybe we shouldn't use it by default...


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 24, 2022, 1:46:22 PM12/24/22
to wx-...@googlegroups.com, Subscribed

@k-serg Note that the problems in the widgets sample are specific to using wxRadioBox and are addressed by #23075 (which is not really dark mode-specific, which is why I created a separate PR for it, but fixes this).


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 24, 2022, 3:33:23 PM12/24/22
to wx-...@googlegroups.com, Subscribed

@k-serg Note that the problems in the widgets sample are specific to using wxRadioBox and are addressed by #23075 (which is not really dark mode-specific, which is why I created a separate PR for it, but fixes this).

I'll try to figure out what's wrong with wxStaticBoxSizer from my part and come back tomorrow with an example (if I figure it out). And thanks again for your excellent work.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 24, 2022, 9:21:13 PM12/24/22
to wx-...@googlegroups.com, Push

@vadz pushed 35 commits.

  • de85e83 Add msw.dark-mode system option to allow turning it on easily
  • 89bb73e Add wxMSWDarkMode::IsActive()
  • 7bcbc34 Add support for using custom theme class in dark mode
  • 54f0680 Support dark mode for windows and dialogs backgrounds
  • 44be3ee Document wxMessageBox dark mode limitation
  • c23ab6c Add MSWShouldUseAutoDarkMode() and use it for wxSpinButton
  • 2559e1f Make wxUxThemeHandle::m_hTheme const
  • b06fa47 Allow constructing wxUxThemeHandle from an HWND too
  • 7875ced Allow customizing both dark theme name and ID
  • 6a8cf23 Enable dark mode support for wxListCtrl
  • 9ff60ca Apply dark mode to the tooltips of the native controls using them
  • 786068e Reuse wxMSWHeaderCtrlCustomDraw in wxListCtrl too
  • 307767b Add wxUxThemeHandle::GetColour() replacing MSWGetThemeColour()
  • c62c46e Add dark mode support to wxHeaderCtrl
  • 2a67e2d Rename WindowHDC private helper class to ClientHDC
  • 74a5fc1 Add WindowHDC RAII helper class
  • ea3540c Add wxMapWindowPoints() private helper function
  • f96d598 Use custom draw for the menu bar in dark mode
  • 1aeda72 fixup! Use dark title bar for top level windows in dark mode
  • b6fa0d9 Use the same background for windows and frames in dark mode
  • 711d899 Document that date/time picker controls don't support dark mode
  • cc5cb84 Make wxActivityIndicator visible when using dark mode
  • 8403dc0 Replace a pair of functions with single MSWGetDarkModeSupport()
  • 44db36f Fix static box and check/radio buttons text colour in dark mode
  • d817b84 Remove unneeded headers inclusion from src/msw/notebook.cpp
  • 0ec1d33 Use proper theme for dark mode support in wxChoice and wxComboBox
  • f66dd06 Start implementing our own wxNotebook drawing in dark mode
  • 39e0b85 Enable using dark scrollbars for all windows
  • 1c682a7 Define wxSYS_COLOUR_BTNSHADOW and HOTLIGHT for dark mode too
  • 9690c51 Paint wxNotebook tabs in all directions in dark mode
  • 62cfc56 Use theme-appropriate default colour in wxFontPickerCtrl
  • 35c6f6f Improve wxToolBar appearance in dark mode
  • 90a4f23 Allow using wxMSWDarkMode::PaintIfNecessary() with any HWND
  • c0064cf Invert the spin control used by wxNotebook in dark mode
  • 9c4f299 Fix wxChoice and wxComboBox drop down scrollbars in dark mode


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12098144670@github.com>

VZ

unread,
Dec 24, 2022, 9:22:21 PM12/24/22
to wx-...@googlegroups.com, Subscribed

I've force pushed this branch to apply the fixups and will merge it relatively soon if there are no objections.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/c1364613996@github.com>

Sergey K.

unread,
Dec 24, 2022, 9:40:56 PM12/24/22
to wx-...@googlegroups.com, Subscribed

Another one: wxRichToolTip painted in default (light) colors.
It's not big problem and easily fixed by:

if (wxMSWDarkMode::IsActive())
{
tip.SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
}
wxRichToolTip


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 24, 2022, 9:51:21 PM12/24/22
to wx-...@googlegroups.com, Subscribed

Thanks, this is indeed easy to fix and I will, but there is also the native tooltip shown for the text control that uses Edit_ShowBalloonTip() currently and I don't see how can we change the colours used for that one at all, so I'm not sure what to do about it -- we could either keep using the native tip with the wrong colours or use our tooltip with better colours but not quite the same appearance.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 24, 2022, 10:17:17 PM12/24/22
to wx-...@googlegroups.com, Push

@vadz pushed 7 commits.

  • 73c86b9 Use theme-appropriate default colour in wxFontPickerCtrl
  • d2fb596 Improve wxToolBar appearance in dark mode
  • 2ecea4d Allow using wxMSWDarkMode::PaintIfNecessary() with any HWND
  • 88b999c Invert the spin control used by wxNotebook in dark mode
  • 664cfee Fix wxChoice and wxComboBox drop down scrollbars in dark mode
  • b26d960 Add wxSystemSettings::SelectLightDark() and use it
  • 67be1c4 Fix wxRichToolTip background colour in dark mode


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12098285699@github.com>

Sergey K.

unread,
Dec 24, 2022, 10:21:25 PM12/24/22
to wx-...@googlegroups.com, Subscribed

@k-serg I can't reproduce this with the following code in the minimal sample:

    auto p = new wxPanel(this);
    auto* s = new wxStaticBoxSizer(wxHORIZONTAL, p, "&Outer");
    auto* s2 = new wxStaticBoxSizer(wxVERTICAL, s->GetStaticBox(), "&Inner");
    s2->Add(new wxCheckBox(s2->GetStaticBox(), wxID_ANY, "&Check me"));
    s->Add(s2);
    p->SetSizer(s);

I've tried using the panel because I couldn't reproduce it without it neither, i.e. if you remove p and use this instead of it, everything still looks fine here.

Could you please provide a minimal patch to the minimal sample allowing to reproduce the above? TIA!

Well... I've found a problem,
I've modified vadz samle:

    auto p = new wxPanel(this);
    auto* s = new wxStaticBoxSizer(wxHORIZONTAL, p, "&Outer");
    auto* s2 = new wxStaticBoxSizer(wxVERTICAL, p, "&Inner");
    s2->Add(new wxCheckBox(s2->GetStaticBox(), wxID_ANY, "&Check me"));
    s->Add(s2);
    p->SetSizer(s);

s and s2 disapear, like I said.

I realy don't understand, why s->GetStaticBox(), instead of p.
We use wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); where parent p (should be) the same, for s and s2, isn't?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/c1364620045@github.com>

Sergey K.

unread,
Dec 24, 2022, 10:42:22 PM12/24/22
to wx-...@googlegroups.com, Subscribed

Nevermind (my mistake), I need to get some sleep, then investigate what's wrong on my part with wxStaticBox.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 25, 2022, 11:45:13 AM12/25/22
to wx-...@googlegroups.com, Push

@vadz pushed 8 commits.

  • c3235aa Use theme-appropriate default colour in wxFontPickerCtrl
  • 0c641a6 Improve wxToolBar appearance in dark mode
  • da45e03 Allow using wxMSWDarkMode::PaintIfNecessary() with any HWND
  • 39217fe Invert the spin control used by wxNotebook in dark mode
  • b91a788 Fix wxChoice and wxComboBox drop down scrollbars in dark mode
  • d2a01f7 Add wxSystemSettings::SelectLightDark() and use it
  • bc98785 Fix wxRichToolTip background colour in dark mode
  • 587816a Don't return true from wxSystemAppearance::IsDark() in light mode


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12100785686@github.com>

Sergey K.

unread,
Dec 25, 2022, 2:21:12 PM12/25/22
to wx-...@googlegroups.com, Subscribed

@vadz Assert on wxDirPickerCtrl:

assert

src/msw/darkmode.cpp [267]:

        if ( FAILED(hr) )
        {
            wxLogApiError(wxString::Format("SetWindowTheme(%08x, %s, %s)",
                                           hwnd, themeName, themeId), hr);
        }

Checked on my own project, and samples\widgets.
Can you confirm?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/c1364727332@github.com>

VZ

unread,
Dec 25, 2022, 2:31:39 PM12/25/22
to wx-...@googlegroups.com, Subscribed

Yes, thanks. There are several problems here, but they're all minor/not really related to the dark mode, I'll push fixes soon.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 25, 2022, 2:46:34 PM12/25/22
to wx-...@googlegroups.com, Push

@vadz pushed 44 commits.

  • 68d73eb Use dark title bar for top level windows in dark mode
  • 573c129 Refactor code to use ShouldUseDarkMode()
  • 2c40966 Enable using dark mode for native controls
  • 1336c57 Use dark Explorer theme for the dialog gripper
  • a14bcdb Adapt wxToolTip colours to dark mode
  • 9ca577f Make message box title bar dark when using dark mode
  • 7fd236b Add msw.dark-mode system option to allow turning it on easily
  • 7a84c0b Add wxMSWDarkMode::IsActive()
  • bd281c2 Add support for using custom theme class in dark mode
  • 810b3ab Support dark mode for windows and dialogs backgrounds
  • 9106a83 Document wxMessageBox dark mode limitation
  • cb85871 Add MSWShouldUseAutoDarkMode() and use it for wxSpinButton
  • 8d3971e Make wxUxThemeHandle::m_hTheme const
  • 4b0c691 Allow constructing wxUxThemeHandle from an HWND too
  • dd0c107 Allow customizing both dark theme name and ID
  • b284786 Enable dark mode support for wxListCtrl
  • ed02083 Apply dark mode to the tooltips of the native controls using them
  • ddd0025 Reuse wxMSWHeaderCtrlCustomDraw in wxListCtrl too
  • ca5f244 Add wxUxThemeHandle::GetColour() replacing MSWGetThemeColour()
  • a37f28b Add dark mode support to wxHeaderCtrl
  • 446f4c6 Rename WindowHDC private helper class to ClientHDC
  • 002b971 Add WindowHDC RAII helper class
  • 252551f Add wxMapWindowPoints() private helper function
  • 1bfdd58 Use custom draw for the menu bar in dark mode
  • aaa6be2 Use the same background for windows and frames in dark mode
  • 717dfda Document that date/time picker controls don't support dark mode
  • 6459652 Make wxActivityIndicator visible when using dark mode
  • 881e216 Replace a pair of functions with single MSWGetDarkModeSupport()
  • 2e45ddc Fix static box and check/radio buttons text colour in dark mode
  • 9fd53c6 Remove unneeded headers inclusion from src/msw/notebook.cpp
  • cbe5e3f Use proper theme for dark mode support in wxChoice and wxComboBox
  • 16727d1 Start implementing our own wxNotebook drawing in dark mode
  • f93fe96 Enable using dark scrollbars for all windows
  • 04e7029 Define wxSYS_COLOUR_BTNSHADOW and HOTLIGHT for dark mode too
  • 0658dd7 Paint wxNotebook tabs in all directions in dark mode
  • 7883971 Use theme-appropriate default colour in wxFontPickerCtrl
  • 61805ef Improve wxToolBar appearance in dark mode
  • 1f939fa Allow using wxMSWDarkMode::PaintIfNecessary() with any HWND
  • 1e8e3f6 Invert the spin control used by wxNotebook in dark mode
  • f42b63e Fix wxChoice and wxComboBox drop down scrollbars in dark mode
  • 30dc335 Add wxSystemSettings::SelectLightDark() and use it
  • dfe2522 Fix wxRichToolTip background colour in dark mode
  • 32daebe Don't return true from wxSystemAppearance::IsDark() in light mode
  • ca5cd2f Don't try creating the gripper before wxDialog is created


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12101384909@github.com>

Sergey K.

unread,
Dec 26, 2022, 8:15:16 AM12/26/22
to wx-...@googlegroups.com, Subscribed

@vadz
I have a question: in my application I'm using wxSystemSettings::GetAppearance().wxSystemAppearance::IsDark()
for checking for system-wide enabled dark mode. When user run application for the first time (and application doesn't have config)
I check system-wide settings like this:

bool isDarkModeDefault = wxSystemSettings::GetAppearance().wxSystemAppearance::IsDark();
//Check application config itself, if entry exists , i.e. user defined this, use config, if not defined use isDarkModeDefault as default value for isDarkMode.
bool isDarkMode = SaveGameProConfig::Get()->GetParameter(wxT("/Appearance"), wxT("DarkMode"), isDarkModeDefault);
if (isDarkMode)
{
    EnableDarkMode(isDarkMode);
}

And depend on what IsDark() returned run application in dark or default mode.
Not only frames/dialogs/etc itself, but also icons (I parse svg's and replace colors in runtime, then make bitmaps from svg's).
Also application performs some custom drawing stuff, like dialog headers, depend on colors, that depend on enabled dar mode or not enabled.

Like this:
Image 2022-12-26 12 00 30
Image 2022-12-22 07 52 37

Until 32daebe it works like expected: wxSystemAppearance::IsDark() return correct values for system-wide dark mode. And application run as expected in light/dark mode.
But now it always return false, cause this:

"we shouldn't
return true from this function unless the application itself uses dark
mode"

The question is: why we have wxSystemAppearance::IsDark() and wxMSWDarkMode::IsActive() which both pointed us to application dark mode? Is this wxSystemAppearance shouldn't pointed us to system settings, not application?
And second: how we may check system-wide dark mode by API right now (not registry entry "AppsUseLightTheme" Software\Microsoft\Windows\CurrentVersion\Themes\Personalize).


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/c1365159774@github.com>

VZ

unread,
Dec 26, 2022, 11:53:06 AM12/26/22
to wx-...@googlegroups.com, Subscribed

There is some confusion about what wxSystemAppearance::IsDark() means. In a lot of code I've seen (I had done code search for it), including our own code in wxGrid and wxAUI, it was clearly used to check if this application appearance was dark, as it's used to choose the contrasting colours and it doesn't make sense to use e.g. white foreground unless the background of this application is black, irrespectively of what the rest of the system is using.

However there is also your use case that I hadn't thought about (sorry) but which does make sense too.

I see 2 possibilities here:

  1. Revert my latest change and really return true from wxSystemAppearance::IsDark() if the system appearance is dark, even if the application appearance is light.
  2. Keep this change and add some new wxApp::MSWShouldAppsUseDarkMode().

(1) has the advantage of being backwards-compatible, but doesn't make much sense otherwise, both for the reasons above (most code using this function really wants to check if the application is using dark mode, not the system) and also because this is not how this function behaves under Mac (where it uses NSApp.effectiveAppearance which is also app-specific) nor under all the other platforms (where it uses IsUsingDarkBackground() which is based on system colours for this application). Also, if we do (1), we need some way of checking whether this application is using dark mode and I have no idea what could we call it without creating a lot of confusion, i.e. how are we going to explain that some wxSystemSettings::IsAppDark() should be used instead of wxSystemAppearance::IsDark().

So I think we need to add another function for querying the system appearance and I think that this function should be MSW-specific because it's the only platform where we can change this (by calling MSWEnableDarkMode()) anyhow.

What do you think?


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 26, 2022, 12:42:09 PM12/26/22
to wx-...@googlegroups.com, Subscribed

@vadz

What do you think?

I see solution that not break existing codebase but logically use wxSystemAppearance as expected (from my humble point of view) by adding:

wxSystemAppearance::AppsUseDark() - for aplicattions (registry entry "AppsUseLightTheme")

and

wxSystemAppearance::SystemUseDark() - Windows itself (registry entry "SystemUsesLightTheme": taskbar, start menu, etc)

(maybe with MSW prefixes - MSWAppsUseDark(), MSWSystemUseDark() respectively).

I think this clearly pointing to the right place without any confusion. Word "Should" not the best (from my taste): in various use case we just check system appearance, not force todo something.

wxApp (again, on my taste), not good place for it: wxApp pointing to something like application behaviour.

Maybe I'm wrong, maybe not, just opinion.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 26, 2022, 1:33:08 PM12/26/22
to wx-...@googlegroups.com, Subscribed

I'm fine with adding new methods to wxSystemAppearance rather than wxApp, the real question to me is whether we change the existing IsDark() in a backwards-incompatible way or not.

So do we all agree on:

  1. IsDark(): is this application itself using a dark theme.
  2. AreAppsDark(): do the applications use dark theme by default (same as IsDark() under non-MSW for now but could change if somebody figures out how to do it).
  3. IsSystemDark(): does the system UI use dark theme (same as AreAppsDark() under non-MSW and will most likely remain this way).

?


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 26, 2022, 4:04:27 PM12/26/22
to wx-...@googlegroups.com, Subscribed

I don't know what others will say, but it seems pretty acceptable to me.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

oneeyeman1

unread,
Dec 26, 2022, 4:09:39 PM12/26/22
to wx-...@googlegroups.com, Subscribed

You have been asked to test it to make sure it really fixed. 😀


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 26, 2022, 5:11:54 PM12/26/22
to wx-...@googlegroups.com, Push

@vadz pushed 2 commits.

  • 7ce2ba9 Add wxSystemAppearance::AreAppsDark() and IsSystemDark()
  • a7b39f6 Send wxEVT_SYS_COLOUR_CHANGED on dark/light theme change in wxMSW


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/push/12108984843@github.com>

VZ

unread,
Dec 26, 2022, 5:13:05 PM12/26/22
to wx-...@googlegroups.com, Subscribed

OK, I've implemented this now and also added wxSysColourChangedEvent generation on the theme change (still no automatic update of the appearance when this happens though).

Please let me know if anybody has any objections, otherwise I'll finally merge this branch soon.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/23028/c1365484865@github.com>

Sergey K.

unread,
Dec 27, 2022, 6:33:47 AM12/27/22
to wx-...@googlegroups.com, Subscribed

I'd like to see something that return current mode:

PreferredAppMode wxMSWDarkMode::GetCurrentMode() const
{
    return gs_appMode;
}

Yes, we have IsActive() but doesn't know how it was activated.

And a little change wxApp enum:

    // MSW-specific function to enable experimental dark mode support.
    enum
    {
        DarkMode_Auto   = 0,  // Use dark mode if the system is using it.
        DarkMode_Always = 1   // Force using dark mode.
    };
    // MSW-specific function to enable experimental dark mode support.
    enum
    {
        DarkMode_Off   = 0    // Never use dark mode
        DarkMode_Auto   = 1,  // Use dark mode if the system is using it.
        DarkMode_Always = 2   // Force using dark mode.
    };

Ofcourse it will be done on my own inside app, as I did already:

    enum class DarkMode
    {
        DARK_OFF,
        DARK_AUTO,
        DARK_ALWAYS
    };


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 27, 2022, 10:55:44 AM12/27/22
to wx-...@googlegroups.com, Subscribed

Sorry, but why should it matter how it was activated? The only thing which matters is whether the app is using dark mode or not and wxSystemAppearance::IsDark() can be used for this and is portable, so I prefer telling people to use it instead of adding another MSW-specific function.

I guess we could add a way to turn off dark mode, but this will only make sense once/if it's ever enabled automatically. As long as it's not the case, I'd rather avoid adding another function when you can just avoid calling MSWEnableDarkMode() in the first place. And if we add it, I'd rather call it MSWDisableDarkMode() instead of adding another enum element because MSWEnableDarkMode(DarkMode_Off) doesn't read well to me.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 27, 2022, 11:55:26 AM12/27/22
to wx-...@googlegroups.com, Subscribed

Sorry, but why should it matter how it was activated?

The first thing that comes to mind:

	void OnSysColourChangedEvent(wxSysColourChangedEvent& event)
	{
		switch (wxMSWDarkMode::GetCurrentMode() )
		{
			//Should we ignore this, because we force it?
			case PreferredAppMode::AppMode_ForceDark:
			...
			
		}
	}

wxSystemAppearance::IsDark() knows nothing about it, and may change independently at runtime.

instead of adding another enum element because MSWEnableDarkMode(DarkMode_Off) doesn't read well to me.

I'd prefer consider those enum as actual state. But I admit if someone thinks otherwise.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 27, 2022, 12:27:21 PM12/27/22
to wx-...@googlegroups.com, Subscribed

I don't know if using IsDark() here works currently, i.e. if ShouldAppsUseDarkMode() already returns true or false by the time this message is generated (have you tested it already by chance?), but it really should, so that the same code would work under all platforms.

As for distinguishing between forcing dark mode or following the system theme, this is your application option, so you already know it and I don't think wx needs to keep track of it.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 27, 2022, 2:29:04 PM12/27/22
to wx-...@googlegroups.com, Subscribed

I don't know if using IsDark() here works currently, i.e. if ShouldAppsUseDarkMode() already returns true or false by the time this message is generated (have you tested it already by chance?), but it really should, so that the same code would work under all platforms.

At first change apps dark mode:
(event processes 6 times, IDK why)

Select Dark->Light:

(27.12.2022 22:47:54) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:47:54) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:47:55) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:47:55) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:47:56) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:47:56) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:47:58) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:47:58) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:47:58) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:47:58) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:48:00) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:48:00) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)

Select Light->Dark:

(27.12.2022 22:44:46) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:44:46) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:44:51) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:44:51) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:44:52) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:44:52) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:44:54) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:44:54) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:44:55) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:44:55) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:44:56) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:44:56) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)

At second and further change apps dark mode:
Select Dark->Light:

(27.12.2022 22:45:59) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:45:59) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:46:01) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:46:01) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:46:04) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:46:04) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:46:05) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:46:05) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:46:06) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:46:06) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:46:08) [14228] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:46:08) [14228] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)

Select Light->Dark (pay attention that first "0" and white):

(27.12.2022 22:48:37) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: white
(27.12.2022 22:48:37) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (0) wxSystemAppearance::IsDark(): (0)
(27.12.2022 22:48:38) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:48:38) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:48:41) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:48:41) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:48:42) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:48:42) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:48:43) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:48:43) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)
(27.12.2022 22:48:44) [7680] 'OnSysColourChanged' wxSystemSettings::GetColour: rgb(32, 32, 32)
(27.12.2022 22:48:44) [7680] 'OnSysColourChanged' wxMSWDarkMode::IsActive(): (1) wxSystemAppearance::IsDark(): (1)

Code that you may copy in any sample:
Connect(wxID_ANY, wxEVT_SYS_COLOUR_CHANGED, (wxObjectEventFunction)&SaveGameProFrame::OnSysColourChanged);

void MyCoolAppFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
{
    bool isActive = wxMSWDarkMode::IsActive();
    bool isDark = wxSystemSettings::GetAppearance().wxSystemAppearance::IsDark();
    wxString col = wxSystemSettings::GetColour(wxSystemColour::wxSYS_COLOUR_WINDOW).GetAsString();

    wxLogDebug("wxSystemSettings::GetColour: %s", col);
    wxLogDebug("wxMSWDarkMode::IsActive(): (%i) wxSystemAppearance::IsDark(): (%i)", isActive , isDark);

    //event.Skip(true);
}

results may vary, depend on event.Skip()

As for distinguishing between forcing dark mode or following the system theme, this is your application option, so you already know it and I don't think wx needs to keep track of it.

Well, I have nothing more to add, do what you think is right.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 27, 2022, 4:21:46 PM12/27/22
to wx-...@googlegroups.com, Subscribed

Merged #23028 into master.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 27, 2022, 4:22:41 PM12/27/22
to wx-...@googlegroups.com, Subscribed

I've merged it as is for now, we can always add more APIs later (while removing them is much more problematic). Thanks again for your testing and please open new issues for the remaining problems (other than those related to AUI and STC that I'll try to address soon).


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Eran Ifrah

unread,
Dec 27, 2022, 4:27:17 PM12/27/22
to wx-...@googlegroups.com, Subscribed

Thanks for the effort invested in this - much appreciated!
I will start using it in CodeLite and will open issues if needed


Reply to this email directly, view it on GitHub, or unsubscribe.

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

PB

unread,
Dec 28, 2022, 7:31:35 AM12/28/22
to wx-...@googlegroups.com, Subscribed

@k-serg wrote

At first change apps dark mode: (event processes 6 times, IDK why)

It is odd that so many events are received but it does happen with the current master. In my wxSystemInformationFrame I log some Windows messages and wxWidgets events. When switching the system dark mode for applications from light to dark (after starting the application), I see the message and event 14 times:

13:24:05: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:05: wxSysColourChangedEvent received.
13:24:05: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:05: wxSysColourChangedEvent received.
13:24:05: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:05: wxSysColourChangedEvent received.
13:24:05: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:05: wxSysColourChangedEvent received.
13:24:05: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:05: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.
13:24:06: WM_SETTINGCHANGE received: wParam = 0, lParam ="ImmersiveColorSet"
13:24:06: wxSysColourChangedEvent received.

Not sure if this is expected, or something I do wrong in my wxSystemInformationFrame code, or something not correct in wxWidgets.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 28, 2022, 12:06:35 PM12/28/22
to wx-...@googlegroups.com, Subscribed

FWIW when I toggle between "Light" and "Dark" in the "Colours" section of the "Settings", I can see 5 WM_SETTINGSCHANGEs being sent to a trivial Win32-only window in my example using Spy++. 5 is not 14 (as above), but the system clearly does send several messages for a single change and I have no idea why.

We could coalesce multiple consecutive messages into a single one, I guess, but it's still weird that it does it.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 28, 2022, 1:28:41 PM12/28/22
to wx-...@googlegroups.com, Subscribed

It seems to me that we should not coalesced messages, we need to store the previous state to the event and then the new one, and compare it in the handler.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Sergey K.

unread,
Dec 28, 2022, 1:32:57 PM12/28/22
to wx-...@googlegroups.com, Subscribed

More interested to me: why on second Light->Dark selection, as I already wrote, I have different values with one message batch.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Dec 28, 2022, 1:36:49 PM12/28/22
to wx-...@googlegroups.com, Subscribed

Apparently Windows sends the first message before actually changing the colours. I think it's because there are actually several changes as it's an animation and not just an immediate change from white to black, but we don't handle the intermediate messages and just get the "compatible" (?) ones.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

PB

unread,
Dec 28, 2022, 2:03:53 PM12/28/22
to wx-...@googlegroups.com, Subscribed

FWIW when I toggle between "Light" and "Dark" in the "Colours" section of the "Settings", I can see 5 WM_SETTINGSCHANGEs being sent to a trivial Win32-only window in my example using Spy++.

I see 14 messages both in Spy++ and the application, using the simplest possible code (Windows 10 22H2):

#include <wx/wx.h>

class MyFrame : public wxFrame
{
public:
    MyFrame() : wxFrame(nullptr, wxID_ANY, "Test") {}
private:
    WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override
    {
        if ( nMsg == WM_SETTINGCHANGE )
            wxLogDebug("WM_SETTINGCHANGE received: wParam = %u, lParam ='%s'", (unsigned)wParam, lParam ? (LPCTSTR)lParam : wxS(""));
        return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
    }
};

class MyApp : public wxApp
{
    bool OnInit() override
    {
        (new MyFrame())->Show();
        return true;
    }
}; wxIMPLEMENT_APP(MyApp);


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Jan 17, 2023, 10:06:41 AM1/17/23
to wx-...@googlegroups.com, Subscribed

It could be nice if it was possible to modify some colours in MSW darkmode, for example with something like wxMSWDarkMode::SetColour(wxSYS_COLOUR_MENUTEXT, wxColour(0xe00000)); to obtain, here, a red menu text, as it appears in some astronomy software when you use their ‘night’ mode. The standard mode exists in those softwares and the global look is quite near the darkmode as it is now, with menus in white (or light gray).
This should be probably called at the beginning of a program, before the build of menus.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Feb 19, 2023, 6:55:41 PM2/19/23
to wx-...@googlegroups.com, Subscribed

@gerard-durand FYI, this is possible now, see #23275, notably wxDarkModeSettings::GetMenuColour(). Any feedback on that PR is welcome, please comment there if you'd like to help improving it before it's merged. TIA!


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Feb 20, 2023, 8:49:37 AM2/20/23
to wx-...@googlegroups.com, Subscribed

Thanks.
Nevertheless, until now no success to make this work. Certainly because I don't understand how it is made and how to use it in my own work. May be it will be better with a small new samples test case, especially with colored text menus and sub menus.
In this last case, I thought, I could already have them with using wxOwnerDrawn::SetTextColour() as you said in interface\wx\msw\darkmode.h, but here too, I'm not able to set this correctly.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Feb 20, 2023, 8:57:47 AM2/20/23
to wx-...@googlegroups.com, Subscribed

The example from the documentation should work, i.e. just

    class MySettings : public wxDarkModeSettings
    {
    public:
        virtual wxColour GetMenuColour(wxMenuColour which)
        {
            if ( which == wxMenuColour::StandardFg )
                return *wxRED;

            return wxDarkModeSettings::GetMenuColour(which);
        }
    };

    wxTheApp->MSWEnableDarkMode(wxApp::DarkMode_Always, new MySettings());

will use red for the top level menus in dark mode.

Customizing normal menu colours is shown in the ownerdrw sample.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Feb 20, 2023, 9:30:30 AM2/20/23
to wx-...@googlegroups.com, Subscribed

Customizing normal menu colours is shown in the ownerdrw sample.

Ok for a single item, but how to set the color globally for all sub-menus items.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Feb 20, 2023, 9:51:09 AM2/20/23
to wx-...@googlegroups.com, Subscribed

There is no support for changing this colour globally, sorry.

The goal of these changes was to just allow customizing the hardcoded colours used in the dark mode because they can be wrong.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Feb 21, 2023, 5:48:27 AM2/21/23
to wx-...@googlegroups.com, Subscribed

I have tested your suggested code in the sample ownerdrw.
I have just added :
if (wxSystemSettings::GetAppearance().IsDark()) wxTheApp->MSWEnableDarkMode(wxApp::DarkMode_Always, new MySettings());
before the call to InitMenu();
To obtain the darkmode, I launch ownerdraw.exe in a cmd file containing :

set WX_MSW_DARK_MODE=2
ownerdrw.exe

Like that, only the last sub-menu (Native) has correct colors in darkmode (black background and white text).
To obtain black backgrounds on submenus, I had to comment lines containing :

pItem->SetTextColour`
pItem->SetFont only for sub-menus
and
pAboutItem->SetDisabledBitmap

There is no support for changing this colour globally, sorry.

Will it be possible in the future ? Because, at least internally, this is done in darkmode with white sub-menus on a black background.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Feb 21, 2023, 8:44:22 AM2/21/23
to wx-...@googlegroups.com, Subscribed

I'm surprised that "File" and "Drawn" menus don't use the correct colours. Could you please open a new issue with the exact diff that you use so that I could test it?

Will it be possible in the future ? Because, at least internally, this is done in darkmode with white sub-menus on a black background.

No, normal menus are drawn in dark mode by Windows itself. It doesn't draw the menu bar correctly in the dark mode, which is why we have to use our own hack for it.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Feb 21, 2023, 10:08:23 AM2/21/23
to wx-...@googlegroups.com, Subscribed

Here is a diff file which is OK for me (with commented lines)
ownerdrw.zip


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Feb 21, 2023, 5:28:28 PM2/21/23
to wx-...@googlegroups.com, Subscribed

Just to add something. If I restore only one attribute commented for a sub-menu, it's all the sub-menu which is displayed with standard colors (not darkmode).


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Feb 22, 2023, 1:58:21 PM2/22/23
to wx-...@googlegroups.com, Subscribed

New remark : If as in the doc of wxDarkModeSettings Class Reference, I use the switch as it is, I obtain many warnings of my compiler (msys2 12.2) like this one:
warning: enumeration value 'wxSYS_COLOUR_SCROLLBAR' not handled in switch [-Wswitch]
If I add a default case like:

switch ( index )
    {
        ...   
        // Default colour used here is 0xe0e0e0.
        return *wxRED;

    default:
        return wxDarkModeSettings::GetColour(index);

    }

It works and I have no compiler warning.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

VZ

unread,
Mar 12, 2023, 8:37:49 AM3/12/23
to wx-...@googlegroups.com, Subscribed

Sorry for the delay with replying, but, in any case, I'm afraid I can't say anything really useful: it's clear that owner-drawn menu items can't be used in dark mode, so I can only document this limitation (which I will do, and will also fix the example to avoid triggering -Wswitch, thanks).


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Mar 13, 2023, 6:55:08 AM3/13/23
to wx-...@googlegroups.com, Subscribed

Thanks for your (whole) work.
I have also the feeling that this darkmode problem for sub-menus is not simple. I use commonly Notepad++. They have a darkmode which is customisable for the main menu and/or main toolbar, but not for sub-menus which are still white on a black background. And, they don't use wxWidgets, but directly the Windows API. So, solving that needs probably to dig deeply inside Windows. :-(
Nevertheless, it's possible to set independently colors for each submenu item, but separators are not affected, there is still a white large clear border around the sub-menus. Not a nice look. May be we'll have to wait for a next Windows correction...


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Apr 3, 2023, 8:08:38 AM4/3/23
to wx-...@googlegroups.com, Subscribed

I continue to test darkmode on Windows.
wxAboutBox, in simple mode as seen in samples\dialogs\dialogs.cpp, is shown with standard Windows colors, even when started with a preceeding set WX_MSW_DARK_MODE=2. Normal: because in this case you use the standard Windows box. All other "about" tests are shown in dark.
In that example, it is possible to force the usage of wxGenericAboutBox in ShowSimpleAboutDialog, line 3458, and it works.
When I try this in my own work, it does not compile because with only #include "wx/aboutdlg.h", wxGenericAboutBox is not found/declared. I have to add explicitely #include "wx/generic/aboutdlgg.h".
Note that in interface/wx/aboutdlg.h, wxGenericAboutBox is declared, but if I understand well, this interface folder is only used for documentation.

It can work in my own work with a simple wxAboutBox if I add a aboutInfo.SetWebSite. In that case, wxAboutBox switches automatically and internally to wxGenericAboutBox.
Nevertheless, in the documentation of wxGenericAboutBox, in one of the windows I have found, it is just stated that we have to use #include "wx/aboutdlg.h":

wxGenericAboutBox()
void wxGenericAboutBox ( const wxAboutDialogInfo & info,
wxWindow * parent = nullptr
)
This function does the same thing as wxAboutBox() except that it always uses the generic wxWidgets version of the dialog instead of the native one.
This is mainly useful if you need to customize the dialog by e.g. adding custom controls to it (customizing the native dialog is not currently supported).
See the Dialogs Sample for an example of about dialog customization.
See also wxAboutDialogInfo
Include file:
#include <wx/aboutdlg.h>

In an other one, it is just stated that we have to use #include "wx/generic/aboutdlgg.h".
But, apparently, both includes are necessary to be able to use directly wxGenericAboutBox, and in my case, obtain a dark about window (even without adding an url).


Reply to this email directly, view it on GitHub, or unsubscribe.

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

gerard-durand

unread,
Oct 26, 2023, 10:13:23 AM10/26/23
to wx-...@googlegroups.com, Subscribed

About wxProgressDialog:
On Windows, wxProgressDialog does not support darkmode, but wxGenericProgressDialog supports it. You can see this in the samples/dialogs if you set WX_MSW_DARK_MODE=2 before launching dialogs.exe.


Reply to this email directly, view it on GitHub, or unsubscribe.

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

PB

unread,
Oct 26, 2023, 10:34:53 AM10/26/23
to wx-...@googlegroups.com, Subscribed

Many (but not all) limitations of MSW dark mode (stemming from the lack of dark mode support in the native controls) are documented, including wxAboutBoxBox() and wxProgressDialog, see https://docs.wxwidgets.org/latest/classwx_app.html#af8c93d7e3345e62a58325f3ab1d158d6

Some others are known and reported, so far without a fix...


Reply to this email directly, view it on GitHub, or unsubscribe.

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

Reply all
Reply to author
Forward
0 new messages