This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: X under full keyboard control


Takuma,

Takuma Murakami wrote:
Michael,


I don't know what you mean with "hook DLL" though.


I'm not sure if we need a separate DLL...  See this article
and follow links in it for details.
http://sources.redhat.com/ml/cygwin-xfree/2004-02/msg00149.html

Here is why we don't need a separate DLL for hooking these keyboard messages, from MSDN:


"A global hook monitors messages for all threads in the same desktop as the calling thread. A thread-specific hook monitors messages for only an individual thread. A global hook procedure can be called in the context of any application in the same desktop as the calling thread, so the procedure must be in a separate dynamic-link library (DLL) module. A thread-specific hook procedure is called only in the context of the associated thread. If an application installs a hook procedure for one of its own threads, the hook procedure can be in either the same module as the rest of the application's code or in a DLL. If the application installs a hook procedure for a thread of a different application, the procedure must be in a DLL. For information, see Dynamic-Link Libraries."


You see, we are only hooking messages in our own thread, so this approach works fine. The reason we keep mentioning a hook DLL is that we also want to hook mouse messages when our application is not receiving mouse events; in those cases the hook is processed in the context of whatever process/thread is currently receiving mouse events, which is why those "global" hooks need to be DLLs.


The only problem with the hook approach for the key combinations in question is that it will only work for NT-based platforms and for only those running NT 4.0 SP3 or later; we will need to check for this before we turn on this hook and we need to make sure that all of this is conditional on whether or not this feature is enabled at runtime or not.

I would go ahead and make this the default, but I would add a runtime option called "-nokeyhook" that allows it to be turned off on platforms that support it.

Harold


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]