unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
       [not found] ` <<83fvvmuyct.fsf@gnu.org>
@ 2013-07-10 22:28   ` Drew Adams
  2013-07-11 16:36     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2013-07-10 22:28 UTC (permalink / raw)
  To: Eli Zaretskii, Drew Adams; +Cc: 14794

> > emacs -Q    ; but same problem with older Emacs versions
> >
> > (w32-register-hot-key [M-tab])
> > (w32-register-hot-key [M-S-tab])
> >
> > Try C-h k M-TAB.  Try M-TAB.  The key is immediately grabbed by Windows.
> 
> Because it is not bound to any command.  If you bind it, it will work
> as expected.

Nope, not as far as I can see.  Add this to the recipe:

(global-set-key [M-tab] 'forward-char)

Makes no difference.  But perhaps you meant something different?

I'm using Windows 7 64-bit, if that makes a difference.
(And the same code worked fine on Windows XP SP3.)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2013-07-10 22:28   ` bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit Drew Adams
@ 2013-07-11 16:36     ` Eli Zaretskii
  2013-07-12  8:20       ` martin rudalics
  2022-02-20 13:29       ` Lars Ingebrigtsen
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2013-07-11 16:36 UTC (permalink / raw)
  To: Drew Adams; +Cc: 14794

> Date: Wed, 10 Jul 2013 15:28:37 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: 14794@debbugs.gnu.org
> 
> > > emacs -Q    ; but same problem with older Emacs versions
> > >
> > > (w32-register-hot-key [M-tab])
> > > (w32-register-hot-key [M-S-tab])
> > >
> > > Try C-h k M-TAB.  Try M-TAB.  The key is immediately grabbed by Windows.
> > 
> > Because it is not bound to any command.  If you bind it, it will work
> > as expected.
> 
> Nope, not as far as I can see.  Add this to the recipe:
> 
> (global-set-key [M-tab] 'forward-char)
> 
> Makes no difference.  But perhaps you meant something different?
> 
> I'm using Windows 7 64-bit, if that makes a difference.
> (And the same code worked fine on Windows XP SP3.)

Turns out it does make a difference.  This documentation page:

  http://msdn.microsoft.com/en-us/library/windows/desktop/ms646309%28v=vs.85%29.aspx

explicitly says that the behavior of the underlying API has changed
since XP: if the hot key is already registered, the API now fails
instead of replacing the old registration with the new.  And Alt+TAB
is hooked by the Windows Explorer.  And indeed, on Windows 7 I see
that the call to RegisterHotKey API consistently fails with an error
code which says "Hot key is already registered".

Unless someone knows a way around this (I searched for it, but didn't
find any solutions, only complaints), I guess this will remain a
"known bug".

Does this work for you with other key combinations, btw?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2013-07-11 16:36     ` Eli Zaretskii
@ 2013-07-12  8:20       ` martin rudalics
  2013-07-12  8:29         ` Drew Adams
  2013-07-12  8:55         ` Eli Zaretskii
  2022-02-20 13:29       ` Lars Ingebrigtsen
  1 sibling, 2 replies; 9+ messages in thread
From: martin rudalics @ 2013-07-12  8:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14794

 > Turns out it does make a difference.  This documentation page:
 >
 >   http://msdn.microsoft.com/en-us/library/windows/desktop/ms646309%28v=vs.85%29.aspx
 >
 > explicitly says that the behavior of the underlying API has changed
 > since XP: if the hot key is already registered, the API now fails
 > instead of replacing the old registration with the new.  And Alt+TAB
 > is hooked by the Windows Explorer.  And indeed, on Windows 7 I see
 > that the call to RegisterHotKey API consistently fails with an error
 > code which says "Hot key is already registered".
 >
 > Unless someone knows a way around this (I searched for it, but didn't
 > find any solutions, only complaints), I guess this will remain a
 > "known bug".

 From what I read on such systems an application that does not have
registered a key itself is allowed to unregister it only if it is
certified in some way and resides in Program Files.

martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2013-07-12  8:20       ` martin rudalics
@ 2013-07-12  8:29         ` Drew Adams
  2013-07-12  8:55         ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2013-07-12  8:29 UTC (permalink / raw)
  To: martin rudalics, Eli Zaretskii; +Cc: 14794

>  From what I read on such systems an application that does not have
> registered a key itself is allowed to unregister it only if it is
> certified in some way and resides in Program Files.

Wow.  That's really too bad.  Thanks for the info, though.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2013-07-12  8:20       ` martin rudalics
  2013-07-12  8:29         ` Drew Adams
@ 2013-07-12  8:55         ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2013-07-12  8:55 UTC (permalink / raw)
  To: martin rudalics; +Cc: 14794

> Date: Fri, 12 Jul 2013 10:20:53 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: Drew Adams <drew.adams@oracle.com>, 14794@debbugs.gnu.org
> 
>  From what I read on such systems an application that does not have
> registered a key itself is allowed to unregister it only if it is
> certified in some way and resides in Program Files.

It's much worse: to unregister a key, you must know its ID (the 2nd
argument to the function).  And how can you that, unless you have
access to the sources of the program that registered the hot key in
the first place?

Moreover, RegisterHotKey can be used so that the hot key is registered
for a specific thread, in which case only that thread can unregister
it.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2013-07-11 16:36     ` Eli Zaretskii
  2013-07-12  8:20       ` martin rudalics
@ 2022-02-20 13:29       ` Lars Ingebrigtsen
  2022-02-20 13:39         ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-20 13:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14794

Eli Zaretskii <eliz@gnu.org> writes:

> Unless someone knows a way around this (I searched for it, but didn't
> find any solutions, only complaints), I guess this will remain a
> "known bug".

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Skimming this bug report, there doesn't seem to be anything to be done
on the Emacs side -- or at least there wasn't eight years ago.

Is this still the case today?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2022-02-20 13:29       ` Lars Ingebrigtsen
@ 2022-02-20 13:39         ` Eli Zaretskii
  2022-02-20 14:04           ` Lars Ingebrigtsen
  2022-02-20 21:13           ` bug#14794: [External] : " Drew Adams
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2022-02-20 13:39 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 14794

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Drew Adams <drew.adams@oracle.com>,  14794@debbugs.gnu.org
> Date: Sun, 20 Feb 2022 14:29:00 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Unless someone knows a way around this (I searched for it, but didn't
> > find any solutions, only complaints), I guess this will remain a
> > "known bug".
> 
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
> 
> Skimming this bug report, there doesn't seem to be anything to be done
> on the Emacs side -- or at least there wasn't eight years ago.
> 
> Is this still the case today?

I think we have a solution for this since Emacs 26.1.  From NEWS.26:

  ** Intercepting hotkeys on Windows 7 and later now works better.
  The new keyboard hooking code properly grabs system hotkeys such as
  'Win-*' and 'Alt-TAB', in a way that Emacs can get at them before the
  system.  This makes the 'w32-register-hot-key' functionality work
  again on all versions of MS-Windows starting with Windows 7.  On
  Windows NT and later you can now register any hotkey combination.  (On
  Windows 9X, the previous limitations, spelled out in the Emacs manual,
  still apply.)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2022-02-20 13:39         ` Eli Zaretskii
@ 2022-02-20 14:04           ` Lars Ingebrigtsen
  2022-02-20 21:13           ` bug#14794: [External] : " Drew Adams
  1 sibling, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-20 14:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14794

Eli Zaretskii <eliz@gnu.org> writes:

> I think we have a solution for this since Emacs 26.1.  From NEWS.26:
>
>   ** Intercepting hotkeys on Windows 7 and later now works better.
>   The new keyboard hooking code properly grabs system hotkeys such as
>   'Win-*' and 'Alt-TAB', in a way that Emacs can get at them before the
>   system.  This makes the 'w32-register-hot-key' functionality work
>   again on all versions of MS-Windows starting with Windows 7.  On
>   Windows NT and later you can now register any hotkey combination.  (On
>   Windows 9X, the previous limitations, spelled out in the Emacs manual,
>   still apply.)

Ah, OK, then I guess there's nothing more to do here, and I'm closing
this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#14794: [External] : Re: bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit
  2022-02-20 13:39         ` Eli Zaretskii
  2022-02-20 14:04           ` Lars Ingebrigtsen
@ 2022-02-20 21:13           ` Drew Adams
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2022-02-20 21:13 UTC (permalink / raw)
  To: Eli Zaretskii, Lars Ingebrigtsen; +Cc: 14794@debbugs.gnu.org

> > > Unless someone knows a way around this (I searched for it, but didn't
> > > find any solutions, only complaints), I guess this will remain a
> > > "known bug".
> >
> > Skimming this bug report, there doesn't seem to be anything to be done
> > on the Emacs side -- or at least there wasn't eight years ago.
> >
> > Is this still the case today?
> 
> I think we have a solution for this since Emacs 26.1.  From NEWS.26:
> 
>   ** Intercepting hotkeys on Windows 7 and later now works better.
>   The new keyboard hooking code properly grabs system hotkeys such as
>   'Win-*' and 'Alt-TAB', in a way that Emacs can get at them before the
>   system.  This makes the 'w32-register-hot-key' functionality work
>   again on all versions of MS-Windows starting with Windows 7.  On
>   Windows NT and later you can now register any hotkey combination.  (On
>   Windows 9X, the previous limitations, spelled out in the Emacs manual,
>   still apply.)

Excellent.  This is good news.  I didn't notice that
in the E26 NEWS.  Thank you.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-02-20 21:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <<fe76a82d-41dd-4c28-8204-aa7c1e4a2aef@default>
     [not found] ` <<83fvvmuyct.fsf@gnu.org>
2013-07-10 22:28   ` bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit Drew Adams
2013-07-11 16:36     ` Eli Zaretskii
2013-07-12  8:20       ` martin rudalics
2013-07-12  8:29         ` Drew Adams
2013-07-12  8:55         ` Eli Zaretskii
2022-02-20 13:29       ` Lars Ingebrigtsen
2022-02-20 13:39         ` Eli Zaretskii
2022-02-20 14:04           ` Lars Ingebrigtsen
2022-02-20 21:13           ` bug#14794: [External] : " Drew Adams

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).