I currently write a small desktop app (in case you are curious http://sourceforge.net/projects/launchmenu) and for this I have to research on how to grab mouse events and eventually keyboard as well. Now I thought that this might be usefull for wine when playing games under the DirectX emulation, so I checked the sources for XGrabButton()/XGrabKey() and I couldn't find any references to it. When I tried to play Thief and Thief 2 I always had the problem that the keys are going to the shell where I started it from, instead of going into the game. I wrote a small test app for my project in order to get this feature straight and there I could capture all mouse events (haven't tried keyboard, but it should work equally well) without any interference with the remaining X system. Is this intenttionally that these functions are not used and if so what is the reason for it? Or is there a layer in between wine and X so that wine is not using Xlib API directly?
I think that using this should work at least in programs where the entire screen is taken over, like in games, probably other applications well.
(snip about XGrab-ing stuff)
I think that using this should work at least in programs where the entire screen is taken over, like in games, probably other applications well.
Well, this would work.... BUT there is a catch : when you grab the display or some keys, only the X connection where you did the grab will get the key events. And as in Wine, you have one connection per thread, you need to be sure to call these X functions from the thread the game does it input from.
Lionel
On Tue, 21 Oct 2003 09:13:28 +0200, Lionel Ulmer lionel.ulmer@free.fr wrote:
Well, this would work.... BUT there is a catch : when you grab the display or some keys, only the X connection where you did the grab will get the key events. And as in Wine, you have one connection per thread, you need to be sure to call these X functions from the thread the game does it input from.
Don't we know this? And even if not, is there no way to forward the event to the normal event chain? In Windows there are Hookfunction and at some hooks you can choose to keep the event or continue it's processing. Is there no such thing in X when you grabbed Keys or Pointer?
On Tue, Oct 21, 2003 at 05:34:17PM +0200, Gerhard W. Gruber wrote:
Don't we know this? And even if not, is there no way to forward the event to the normal event chain? In Windows there are Hookfunction and at some hooks you can choose to keep the event or continue it's processing. Is there no such thing in X when you grabbed Keys or Pointer?
AFAIR (Alexandre can correct me if I am wrong), this was something we had a long time ago (ie one thread that did all the input for all threads and then re-directed the events to the correct one). And as part of all the memory separation / threading rework, this has been suppressed by the concept of each thread having its own event loop + X connection.
In the X way of things, this could be something done at the WM level (ie say to the WM the we want to have the cursor confined to this window).
Lionel
AFAIR (Alexandre can correct me if I am wrong),
I think we can make that an abbreviation too: ACCMIIAW Will be widely used in almost every wine list posting :)
bye Fabi