From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jussi Lahdenniemi Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Override Windows default Win-* key combinations when using Emacs Date: Tue, 12 Jan 2016 13:16:14 +0200 Organization: Aprikoodi Oy Message-ID: <5694E07E.8010005@aprikoodi.fi> References: <568BBC58.50702@aprikoodi.fi> <83y4c43qkh.fsf@gnu.org> <5691667C.5000009@aprikoodi.fi> <838u3wkkvb.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1452597401 27183 80.91.229.3 (12 Jan 2016 11:16:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Jan 2016 11:16:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 12 12:16:32 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aIwwA-0007FN-Td for ged-emacs-devel@m.gmane.org; Tue, 12 Jan 2016 12:16:31 +0100 Original-Received: from localhost ([::1]:59235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIwwA-00025L-71 for ged-emacs-devel@m.gmane.org; Tue, 12 Jan 2016 06:16:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIww6-000259-SL for emacs-devel@gnu.org; Tue, 12 Jan 2016 06:16:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIww5-0005Fu-Eq for emacs-devel@gnu.org; Tue, 12 Jan 2016 06:16:26 -0500 Original-Received: from nbjjceehcbh.turbo-smtp.net ([199.244.72.17]:42302) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aIww5-0005FD-8x for emacs-devel@gnu.org; Tue, 12 Jan 2016 06:16:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aprikoodi.fi; s=turbo-smtp; x=1453202185; h=DomainKey-Signature: Received:Received:From:Subject:To:References:Cc:Organization: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=Nh1kQYhpq4tp+DRGio9tnVKFP1Q1mzqzcW 4h7j58TC0=; b=0zV/jEy2O436XiQ8wwZBWDjxweMOHS5e8E0vXSoezohtCqv76C HvHLmqntMDu//c1ATLwHfseie+o1JuVxHn9A7+XzwnmUc2r9NOh/1Z5I6nfDMo1O tYhKBTgr9IWOAefnMTFLyRaXd2nmrLV3yIIzxIOl6cLbzYidzskFs2kaI= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=turbo-smtp; d=aprikoodi.fi; h=Received:Received:X-TurboSMTP-Tracking:From:Subject:To:References:Cc:Organization:Message-ID:Date:User-Agent:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=AEpvntj2YQzGMxUrDmSd3W7R3OrJfqc4NeBBi3eRzMR2BEH6yY1JM+uQiOTen9 cE+RUwRj9OsqGL6nX4C0Jfvq7JdCz2TfUrUvaZisVr6EsgsnFgZoPUVDzPZ0pWhi 5MhZNP9Yk7ocsNPZ0pZ2q7iS6dk5Ozaro5f+EdrVukqrQ=; Original-Received: (qmail 28236 invoked from network); 12 Jan 2016 11:16:17 -0000 Original-Received: from unknown (HELO ?192.168.100.12?) (authenticated@193.64.142.74) by turbo-smtp.com with SMTP; 12 Jan 2016 11:16:17 -0000 X-TurboSMTP-Tracking: 2729364477 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <838u3wkkvb.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 199.244.72.17 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198072 Archived-At: >> The patch is attached. I decided to place the new functionality in a new >> file (w32hook.c) - it could have been added to some existing file as well. > > I'd prefer not to create a new file, but to have this in w32fns.c. It > might even allow you to make some functions static. OK. >> -@findex w32-register-hot-key >> -@findex w32-unregister-hot-key >> - MS-Windows reserves certain key combinations, such as > > I'm not sure I understand why you moved this stuff down in the file. > Was something wrong with its original place? You could make the > changes without moving the stuff, no? In the documentation for w32-register-hot-key I am now referring to the w32-[lr]window-modifier variables; there is a strongish dependency between these now. For this reason, I preferred documenting the w32-*-hot-key functions after the w32-*-modifier part. But of course, this is not a must. >> + The hotkey registrations always also include all the shift and >> +control modifier combinations for the given hotkey; that is, >> +registering @kbd{s-@key{a}} as a hotkey gives you @kbd{s-@key{A}}, >> +@kbd{C-s-@key{a}} and @kbd{C-s-@key{A}} as well. > > I believe you meant to use "C-S-" etc. here, for the Shift key (not > "super"). No, what I mean is that registering s-a also registers S-s-a, C-s-a, and C-S-s-a. I wrote S-*-a as *-A in that documentation, base on the observation that for example C-h k M-S-a is shown as M-A by Emacs. But maybe it would be better to write a lower-case a and explicit S modifier in all the cases? >> - if (NUMBERP (Vw32_phantom_key_code)) >> - key = XUINT (Vw32_phantom_key_code) & 255; >> - else >> - key = VK_SPACE; > > It looks like you are removing the support for this feature. Is it > really not needed anymore? If so, we should mention this change in > NEWS, and tell there how to achieve the same effect without this > variable. True. I have never used the w32-phantom-key-code myself, so I did not notice that (and, actually, the variable is still checked - unnecessarily - in w32inevt.c). But, setting w32-pass-[lr]window-to-system to NIL has now the desired effect even without the use of a phantom key code; the keypress is routed directly from the hook function to the Emacs input handler, without passing through the standard system keyboard functionality inbetween, which eliminates the need to lie to the system about the key that has been pressed. > I've briefly reviewed the rest of the patch, and it looks OK to me. > Did you make sure the new code doesn't call any API that might be > unavailable on older systems? We still support Windows 98 and later. Unfortunately, Windows 98 does not include the low-level keyboard hook functionality that is essential for my code to work. It is supported in Windows 2000 (and even NT4, apparently), but not on the 95/98/ME branch. So, probably I would need to change the code so that the old functionality is preserved and used if the new API are not available (pre-Win2000), in the same style that w32uniscribe works? It should still even be possible to write a single configuration file that works on both environments. > Also, I understand that this code will work on versions of Windows > before v8, is that right? I have tested the code on Windows 10 (my physical PC) and Windows 7 (in a VM) both as 32-bit and 64-bit versions. I'll try to get Win2000 installed on another VM as well and test with it, just to be sure. -- Jussi Lahdenniemi