From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#51404: Support system dark mode on Windows 10 Date: Sat, 29 Jan 2022 10:40:01 +0200 Message-ID: <83r18raqam.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37134"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51404@debbugs.gnu.org To: Vince Salvino Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 29 09:41:09 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nDjID-0009Xm-3A for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Jan 2022 09:41:09 +0100 Original-Received: from localhost ([::1]:53626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDjIC-0007FR-7W for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Jan 2022 03:41:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDjI6-0007FJ-08 for bug-gnu-emacs@gnu.org; Sat, 29 Jan 2022 03:41:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDjI5-0000bW-Ms for bug-gnu-emacs@gnu.org; Sat, 29 Jan 2022 03:41:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nDjI5-0000bA-Hn for bug-gnu-emacs@gnu.org; Sat, 29 Jan 2022 03:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Jan 2022 08:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51404 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51404-submit@debbugs.gnu.org id=B51404.16434456232235 (code B ref 51404); Sat, 29 Jan 2022 08:41:01 +0000 Original-Received: (at 51404) by debbugs.gnu.org; 29 Jan 2022 08:40:23 +0000 Original-Received: from localhost ([127.0.0.1]:60969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDjHS-0000Zz-Rc for submit@debbugs.gnu.org; Sat, 29 Jan 2022 03:40:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDjHQ-0000Zn-OK for 51404@debbugs.gnu.org; Sat, 29 Jan 2022 03:40:21 -0500 Original-Received: from [2001:470:142:3::e] (port=42390 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDjHL-0000Ta-4x; Sat, 29 Jan 2022 03:40:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=KBZqnXw5a5Qw0jGZc2GfOBoMUfkN94+GnrOkVXkpvrQ=; b=nK6C98rCXqxm Ib51PasvyTyNKPxHsy9WVbnuyvOcjb+RI1O5i9x9SzLpueJPnVzBsPvkTBIxZZP/PX6eJuL0CgxoQ kNxvwRw10hWw0ifKl1Xhx59EVS5yu76RzHDgwOct3ZE59WKx8ZNe+s6d1Lt1gMDp94KL25b6C0qYt DX6ahZEwhIryUReb00X/PgjsuJz4rt6EIpHvEHjdvz3XSKsnKOh71DIc9B7r1fGscMfSWL6/RXFRj 1q3+VIwpoRQKALBB1paue05utvPnaBDOnWnjGcovUwq2j0AB0XdEfyxLXoOkuuYdejR0lSMVKiajg Z+4nIUOFcOvFQWmRWGTHqA==; Original-Received: from [87.69.77.57] (port=1750 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDjHG-0000du-Qu; Sat, 29 Jan 2022 03:40:14 -0500 In-Reply-To: (message from Vince Salvino on Sat, 29 Jan 2022 03:34:32 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:225512 Archived-At: > From: Vince Salvino > CC: Eli Zaretskii > Date: Sat, 29 Jan 2022 03:34:32 +0000 > > Update: I improved the previous patch to use a linked list to track the window handles during runtime, and am reasonably happy with it. If this looks good please go ahead and install the attached patch 0002 to master. Thanks! Thanks. A few comments below, mostly about minor stylistic issues. > From a8c2f353372d8f015538804e17682e72e40af222 Mon Sep 17 00:00:00 2001 > From: Vince Salvino > Date: Fri, 28 Jan 2022 22:25:13 -0500 > Subject: [PATCH] Support MS-Windows light/dark mode theme change during > runtime. (Bug#51404) Please provide a ChangeLog-style description of changes (see CONTRIBUTE for the details of the format we prefer). > -/* If the OS is set to use dark mode. */ > +/* If the OS supports light/dark mode. */ ^^ Our style is to leave 2 spaces after the final period of the comment (here and elsewhere in your patch). > +/* Simple linked list to track window handles during runtime so they > + can be updated if the Windows light/dark mode theme is changed. */ > +struct HWND_NODE > +{ > + HWND hwnd; > + struct HWND_NODE *next; > +}; > +struct HWND_NODE *g_hwnd_root; I see where you add windows to the list, but I don't see where you remove deleted windows from the list. Does that mean the list will always grow indefinitely through an Emacs session, even if windows are deleted? > /* Applies the Windows system theme (light or dark) to the window > - handle HWND. */ > + handle HWND. `track` should generally be TRUE to keep a reference ^^ Two spaces between sentences there. Also, our style of quoting in comments is 'like this', not MD-style `like this`. > + /* After applying the theme, add the HWND to our global list so > + it can be changed later if the OS light/dark mode theme is > + changed. */ > + if(track) > + { > + struct HWND_NODE *curr = malloc(sizeof(struct HWND_NODE)); Please use xmalloc, not malloc, to allocate memory. Also, our style is to leave one space between a function name and the opening parenthesis that follows it. > + /* Loop through all known HWNDs and apply theme */ ^^ Each comment should end with a period (and 2 spaces). > + struct HWND_NODE *curr = g_hwnd_root; > + while ( curr != NULL ) ^^^^^^^^^^^^^^ Our style is NOT to leave a space after the opening parenthesis and before the closing parenthesis.