unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Vince Salvino <salvino@coderedcorp.com>
To: "51404@debbugs.gnu.org" <51404@debbugs.gnu.org>
Subject: bug#51404: Support system dark mode on Windows 10
Date: Fri, 14 Jan 2022 06:00:07 +0000	[thread overview]
Message-ID: <CH2PR12MB4231911F0F61BB71330BCB90A5549@CH2PR12MB4231.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CH2PR12MB4231758A937F6FB9F33291CFA5849@CH2PR12MB4231.namprd12.prod.outlook.com>

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






  parent reply	other threads:[~2022-01-14  6:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26  4:46 bug#51404: Support system dark mode on Windows 10 Vince Salvino
2021-10-26 14:01 ` Eli Zaretskii
2021-10-26 16:18   ` Eli Zaretskii
2021-10-26 16:49   ` Vince Salvino
2021-10-26 17:05     ` Eli Zaretskii
2021-10-26 18:20       ` Vince Salvino
2021-10-27 21:41         ` Vince Salvino
2021-10-28  7:15           ` Eli Zaretskii
2021-10-30 10:34             ` Eli Zaretskii
2021-10-30 17:13               ` Vince Salvino
2021-10-30 17:39                 ` Eli Zaretskii
2021-11-11  5:36                   ` bug#47291: " Lars Ingebrigtsen
2021-11-11  7:51                     ` Eli Zaretskii
2021-11-11 12:15                       ` Lars Ingebrigtsen
2021-11-11 15:08                         ` Eli Zaretskii
2021-11-12  3:00                           ` Lars Ingebrigtsen
2021-11-12  6:19                             ` Eli Zaretskii
2022-01-14  6:00 ` Vince Salvino [this message]
2022-01-23  0:00 ` Vince Salvino
2022-01-29  3:34   ` bug#51404: " Vince Salvino
2022-01-29  8:40     ` bug#51404: " Eli Zaretskii
2022-01-29 20:27       ` Vince Salvino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR12MB4231911F0F61BB71330BCB90A5549@CH2PR12MB4231.namprd12.prod.outlook.com \
    --to=salvino@coderedcorp.com \
    --cc=51404@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).