From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vince Salvino Newsgroups: gmane.emacs.bugs Subject: bug#51404: Support system dark mode on Windows 10 Date: Fri, 14 Jan 2022 06:00:07 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6334"; mail-complaints-to="usenet@ciao.gmane.io" To: "51404@debbugs.gnu.org" <51404@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 14 07:02:30 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 1n8FfR-0001Ro-LS for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Jan 2022 07:02:29 +0100 Original-Received: from localhost ([::1]:38966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8FfQ-0003Yr-Kv for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Jan 2022 01:02:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8FeE-0003Ua-Fr for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2022 01:01:17 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42365) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n8Fe1-0000mC-QF for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2022 01:01:14 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n8Fe1-0006N0-Pe for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2022 01:01:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Vince Salvino Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jan 2022 06:01: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.164214002124417 (code B ref 51404); Fri, 14 Jan 2022 06:01:01 +0000 Original-Received: (at 51404) by debbugs.gnu.org; 14 Jan 2022 06:00:21 +0000 Original-Received: from localhost ([127.0.0.1]:35268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8FdN-0006Ll-4Y for submit@debbugs.gnu.org; Fri, 14 Jan 2022 01:00:21 -0500 Original-Received: from mail-dm6nam10on2066.outbound.protection.outlook.com ([40.107.93.66]:48544 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8FdI-0006LN-9M for 51404@debbugs.gnu.org; Fri, 14 Jan 2022 01:00:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f+rsYW9r5XkDuFd4Vm77akFLAF807OuD2FbOW07sRwfoAEQ0c9Eb7Qk0ODmyn6J53FObR/aStV6QjCK8hd3014vXEAVO+TawdxQrQ822bmamxOLe79Kh++ScI0q0u8fNW57wOs1y5MkaTpgkwJVN8578UZwTN/CCqymM+F8MXLnckwDBZntK+zCMUUPUdk/tk7qnJ+ZlBU19GSoS5kHlHQQNGlJClFUjHL8KvJEN21rfBJHPTQN/+YJFfuquDb8zLSNS9BFvZp27Xefa/CVe7mcQeVEfa5iVFU9K/a2fnY1bqmjHMHN8fLTeQKpw77zXSeovqqhCEz1GmS6yPJAnng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GUlrQj1viE6+81yrkqee7H5BmBigl/2ORqq/lGMkruM=; b=NEj+dC4UQjhhMIoDHkhpyI8LWvgC49ZZ4Q6/ShkZaSFvG7y8eLjOWKFZO+vA0jh0IPehEvd31gX+u10FE5GMhXXUo5ymxIE8qHEtSJv4uc3lv7iN1q2chYFv5lrpBtXAvO8uKTmCGC5RdMAxBGy6Snhc03eRvS/vwgyjk78VzbgI/cnd6MUXmP16NEDe9MriT6/zG/psTmk8qbvSvoCmBOb79Ye/ZuLW6HOBiBGNNqU4bf32tXQqA77ceyOO+g/LWl+u0n/MQP24f63CL54BQvhPUbB3hlUqTcTnG8eIfgFUESuY49T6gVRaqM5jsYKyOWmXD4LJJkP0Oa4m6S5B3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=coderedcorp.com; dmarc=pass action=none header.from=coderedcorp.com; dkim=pass header.d=coderedcorp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coderedcorp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GUlrQj1viE6+81yrkqee7H5BmBigl/2ORqq/lGMkruM=; b=BTdm7DKS6x0bks7/C9rdQrGV/hBlwnqJy/lVwbBRkenoSQnU0W0JjYmbeDCbLOSTVPB5YDx+kDqhL7w6gxroZlmJxUAAoVmHkJzneSfaxPA9cRlZDhDVNcbSaGaCqNs4A6pJ9zWB81QzSP8QhrneDS8DqZw7ChoERgz6GbR+MDY= Original-Received: from CH2PR12MB4231.namprd12.prod.outlook.com (2603:10b6:610:7d::24) by BN6PR12MB1890.namprd12.prod.outlook.com (2603:10b6:404:106::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Fri, 14 Jan 2022 06:00:08 +0000 Original-Received: from CH2PR12MB4231.namprd12.prod.outlook.com ([fe80::859e:5a4f:dd62:bb26]) by CH2PR12MB4231.namprd12.prod.outlook.com ([fe80::859e:5a4f:dd62:bb26%9]) with mapi id 15.20.4888.012; Fri, 14 Jan 2022 06:00:07 +0000 Thread-Topic: Re: bug#51404: Support system dark mode on Windows 10 Thread-Index: AdgJCXUnHIWz0hl5QLGKO1c7MQ7Y5A== Accept-Language: en-US Content-Language: en-US authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=coderedcorp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 99c3be87-1f58-42f3-f844-08d9d7231e1e x-ms-traffictypediagnostic: BN6PR12MB1890:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8x9/zDxI6V+jOycWvgPkogoPawDXL1vtyOgBoZwR6aQ7Ya372O8F4SQy/wEKYis4nP8r2ZwdS0L09N7zI+FJwTtAaSLnxKcEuzgundVxLBCori1qSVOYuOYs7A82CaJlGtEjsQ9taat8Eu4lBE5VtrGWYTvgSZYjQqNCdYz7yJfDIyFWSCDK4PNV+Vd6QHGeEF9EmP44oTYLkm9Cblc4bJRb/yrWZmrn3kuSdJUGM2dHA707GGD8+HHbholVVYByz1aoZC38YRzOaBOx41tTnSAR4SnptyxZdr73oAUmuf2AdHpZoeZmgh6/lJiDLz6oX8qtzEpvF7qXxyYUUTcGCTjfpvN8hpmSHcYPVM4BwieNNrqyarAZcmeRdASUwLphzGEW3TQndvt2VFIpnTP8Y7fH9kw4jQKOEcdoJ11+ogs8Z4PWrConeKNhmMVQqKLQMsmccKqtG2+xBqRtQ7m+e2JcYquzotRlWzYYmFK/NVlHgQEG4qo6Aka6p9wKJOYOpHRqw0IbDDgjqxYFU7shPzMSxlhBp5y2uCCSQXthrVsZsAhvRF/smDonmJfcRlQ2JKSZ805VL/WnQV5o2GAgFWGlyJyLU+xUi7F+JU18H4rAzCUvnnNolpAcQTWAIqZAerUE7a0R1u+4pv+wNozXnSCVOsSaOToAgEaWWexPmDCdiyFQs1HNUHR+ZwgUtttHENl+4ECRGc4tB3IkV7QaTQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4231.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(39830400003)(136003)(346002)(396003)(376002)(5660300002)(508600001)(9686003)(66556008)(64756008)(66946007)(66476007)(76116006)(66446008)(52536014)(83380400001)(2906002)(122000001)(7696005)(186003)(71200400001)(26005)(33656002)(8676002)(8936002)(38070700005)(86362001)(38100700002)(6916009)(6506007)(316002)(55016003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: p4xCf9+RC83DuLlJOi3UM8QrfucrzhMgXFKDtKF95w25Yl/pfW5M+c5IpLhiBLq4mvMPXQZr1NiMxRkAJsKm0QtxdKKJtiXYANF2ZMIQ+IDnmjgL1a5+8ZnNSxateWiQZmDJyNI2tfrevya2So0hPKpzfM03j08AFDZGShqY3tIRRj2CJyQGemxlC2T0HFfh4EcpO8e9/d9TcLmbX+cP2Zw8Rh9HSaVEBuNKasv5V3Ws0Ao4Ye9T3Phr285TCdv9MfSc0eTlJy/9+H4pMNphBX7vGkPiah0ErEZsvc6WcXZOZoTw7do8Q5Mo//nl6RhJXAIDyS244fvkCLo6Vryk4vJpYdVKzC3YYLmNEzvQJ/RZt0xP2ehOUVOgD8LL6Bs4qVTw9WV5u7U01ryBdMj/dmnfk0NdNvJQ4h8krzrEZ/GlAC3/gwovNaIySTcpQ/1WeQ/S7Mz4cbgiZJ5urEPkXT5UZSxwBD9TlotbENezAWspHA5evOHLQQ0+2kDUOmXkBi38/4IuCVdUbKZJPBY+BqAeTA9de0cuVL8pjmuzsicAxZEVCLzzuBbs5Z3w+gOyQv7/eWtrzDhe+7hmmf3AOcF2PoXFCba3Sndqm/DEh0obn110cHUA+Vx3JrFkPWMERhBs+fAheIN8rWXFo+h7LWnPR+sEYSrUhpU1igGANwQTYbHpiZefCS7Kt3kvIp01jX/PGBD9E36WzoUZ+tFFWZB2t0RlvsSoPgmGDtfmVqWerSzHM+moO/eBjO nuR9Iq8CgGRpfSqr4IERIHjU4AKhXhuL9evokcWp1B9L+NFIZr5LDTjvCy/1MW60r7HQzif26ObwscwB0kmCeHczj+qvizq9HO X-OriginatorOrg: coderedcorp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4231.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99c3be87-1f58-42f3-f844-08d9d7231e1e X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2022 06:00:07.6935 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9c94adb1-2ce8-484f-be82-c9b5127d4cb1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PletuxCnsixuBm1Q32jQV2aQlrBlyMH+cBACge24GspYeI4KRST5Fhk3hb7hCq4ATP7ZBvx/7ujqTPq3WYzDyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1890 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:224149 Archived-At: So, playing around with the idea of dynamically toggling dark/light modes o= n-the-fly, rather than only at program initialization as this patch current= ly 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 i= n 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 modif= ications) 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 w= ould 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 =3D [] w32_wnd_proc() { ... case WM_SETTINGCHANGE: for each hwnd in global_hwnds { w32_applytheme(hwnd); } ... } Thoughts? Is it worth it? Vince Salvino