GNU bug report logs - #51404
Support system dark mode on Windows 10

Previous Next

Package: emacs;

Reported by: Vince Salvino <salvino <at> coderedcorp.com>

Date: Tue, 26 Oct 2021 06:58:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Vince Salvino <salvino <at> coderedcorp.com>
To: "51404 <at> debbugs.gnu.org" <51404 <at> debbugs.gnu.org>
Subject: bug#51404: Support system dark mode on Windows 10
Date: Fri, 14 Jan 2022 06:00:07 +0000
So, playing around with the idea of dynamically toggling dark/light modes on-the-fly, rather than only at program initialization as this patch currently does. I got a proof of concept working, however there is one ugly caveat. In order to change the theme, we must keep track of every window handle in existence (frame, scroll bar, other UI element) in a global.

The code for this is relatively simple, we can watch for WM_SETTINGCHANGE (in w32_wnd_proc) and then call w32_applytheme (which also needs a few modifications) to all of the HWND objects. But it seems like it would get quite messy and bloated to be storing references to all of these in globals. We would probably need some kind of array of references, and then loop through them upon receiving the signal.

The pseudo-code is something like:

	// Add every hwnd in existence to this array.
	global_hwnds = []

	w32_wnd_proc() {
		...
		case WM_SETTINGCHANGE:
			for each hwnd in global_hwnds {
				w32_applytheme(hwnd);
			}
		...
	}

Thoughts? Is it worth it?

Vince Salvino





This bug report was last modified 2 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.