emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Override Windows default Win-* key combinations when using E


From: Jussi Lahdenniemi
Subject: Re: [PATCH] Override Windows default Win-* key combinations when using Emacs
Date: Tue, 12 Jan 2016 13:16:14 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

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.

address@hidden w32-register-hot-key
address@hidden 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 @address@hidden as a hotkey gives you @address@hidden,
address@hidden@key{a}} and @address@hidden 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]