PDA

View Full Version : Stop grabbing my keyboard :(


blablabla
08-10-2009, 02:52 PM
To all game developers, porters and everyone else,

please stop grabbing my keyboard, as it get's me very frustrated.

The other day I was playing World of Goo and found out I couldn't change the sound volume with my keyboard, so I tried to alt+tab, but guess what..
The game grabs the whole keyboard, I had to go to windowed mode to do anything. I got angry and kept wondering why the hell a game that only uses the mouse has to grab my keyboard.

But that isn't the only game, I found out almost every game on linux grabs the whole input.
How come? no idea, please tell me.

I know of etswitch, but that doesn't work for every game (like warsow).
So I fixed it myself http://www.warsow.net/forum/viewtopic.php?id=20771
for warsow.

Now I'm planning to do a few other games too (I'm not a good programmer,
but I learn fast).
So if anyone has a favorite game to fix, I might do that one next.
Because I think this is one of the things that keeps the windows users from using (playing games on) linux.

pvtcupcakes
08-10-2009, 10:57 PM
eduke32 does this too. It's a huge pain.

Kano
08-10-2009, 11:44 PM
@blablabla

That's really annoying even when you play caster3d, when you use wine then it works...

Zhick
08-11-2009, 03:35 AM
Wow do I know what you mean...
Fortunately HoN got it right, even though everything is horribly slow when you alt+tab out.
AFAIK this is some limitation in SDL (I seem to remember Svartalf saying something like that). I'm no expert though... :p

blablabla
08-11-2009, 03:38 PM
I don't think sdl grabs all the imput all the time.
But others games not using sdl do the same.

Anyway, as I said, this is one of the things that keep people from using linux.
Because in windows it's a common thing to alt+tab out of a game.

A lot of gamers use irc while gaming, are on teamspeak (push button to talk) and want to quickly alt+tab out of the game to look up soem console command.

All these things can't be done when an application grabs the keyboard (mouse), you can't even change the volume of your system because of the grab.

So we definitely need to do something about this.
I'll be doing some other games too, but I'm a little busy atm.

Dragonlord
08-11-2009, 05:33 PM
Anyway, as I said, this is one of the things that keep people from using linux.
Because in windows it's a common thing to alt+tab out of a game.
In what kind of dream world are you living? In windows it's one of the main problems that you can't alt-tab out of a game. Either you can't get out of it or once you do you can't get safely back into it. Under Linux this is a lot less of a problem. If I want to I can totally override a hotkey of an application in Linux which I can't in windows.

deanjo
08-11-2009, 05:52 PM
In what kind of dream world are you living? In windows it's one of the main problems that you can't alt-tab out of a game. Either you can't get out of it or once you do you can't get safely back into it. Under Linux this is a lot less of a problem. If I want to I can totally override a hotkey of an application in Linux which I can't in windows.

Huh? I alt-tab all the time out of games in windows to read walk-thru (yes I get stuck in games and cheat occasionally.).

blablabla
08-11-2009, 06:01 PM
In what kind of dream world are you living? In windows it's one of the main problems that you can't alt-tab out of a game. Either you can't get out of it or once you do you can't get safely back into it. Under Linux this is a lot less of a problem. If I want to I can totally override a hotkey of an application in Linux which I can't in windows.

Seems then you are one of the only people in the real world then.
What you are saying maybe true for some games, but in most games (I played) it just works.

Anyway, you have to admit that it's a much bigger problem in linux where almost every game grabs the keyboard.

poofyyoda
08-11-2009, 06:23 PM
There needs to be a better balance for convenience. Using common combos like ALT + TAB, ALT + F4, and audio controls need to work for sure.
However, some key combos will disrupt gaming, such as workspace switching ( CTRL + ALT + <DIRECTION> ).
Now that combo really pisses me off when I'm using dosbox which does not grab the screen.


To work around these shortcomings, I like to create scripts for all my games to launch in a seperate X Displays. Unfortunately, those SDL games, like ut2004, world of goo, etc.., don't like it and refuse to run.

Dragonlord
08-11-2009, 07:55 PM
Huh? I alt-tab all the time out of games in windows to read walk-thru (yes I get stuck in games and cheat occasionally.).
Windows games use most of the time DirectX for input processing which bypasses the windows input processing. As a result the games can totally block you from getting out of them or get in trouble if you manage to escape them. Under Linux input goes through X and you do not bypass the input ( if the game is written in a sane way ). You can avoid DX for input processing on Windows which puts you up on the same level as Linux doing proper input handling. Besides there is no sane reason to try to bypass X input in Linux to do a game.

RealNC
08-11-2009, 08:26 PM
The majority of Windows games stopped crashing while Atl+Tabbing after the Windows 98 days were over. That's not an issue anymore. I take it now for granted that I can task switch while a game is running. And when I can't, I'm pretty heavily annoyed.

deanjo
08-11-2009, 09:15 PM
Windows games use most of the time DirectX for input processing which bypasses the windows input processing. As a result the games can totally block you from getting out of them or get in trouble if you manage to escape them. Under Linux input goes through X and you do not bypass the input ( if the game is written in a sane way ). You can avoid DX for input processing on Windows which puts you up on the same level as Linux doing proper input handling. Besides there is no sane reason to try to bypass X input in Linux to do a game.

Still doesn't change the fact that the very few ever do and the "real world" that you are presenting is more of a case of "bizzaro world". It's been quite literally years since I have had a game in windows lock out alt-tab and if they do exist they usually issue a patch to fix it so that you can.

deanjo
08-11-2009, 09:17 PM
The majority of Windows games stopped crashing while Atl+Tabbing after the Windows 98 days were over. That's not an issue anymore. I take it now for granted that I can task switch while a game is running. And when I can't, I'm pretty heavily annoyed.

Bingo, we have a winner.....;)

Setlec
08-12-2009, 01:31 AM
here are some games that you can't alt+tab on windows and linux:
ETQW, doom3, nwn (linux might be bugged for me), world of goo.
multimedia key tends to become nullmedia key

L33F3R
08-12-2009, 01:51 AM
tech3 games aswell. WOLF:ET loved to be a pain in my rear

Setlec
08-12-2009, 03:16 AM
oO really? never thought about alt tab in this game b4...

val-gaav
08-12-2009, 04:53 AM
There needs to be a better balance for
However, some key combos will disrupt gaming, such as workspace switching ( CTRL + ALT + <DIRECTION> ).
Not to mention that this shortcut is window manager specific. For example in KDE4 with kwin you change workspaces with ctrl+F1, ctrl+F2, ctrl+F3 ... etc.


To work around these shortcomings, I like to create scripts for all my games to launch in a seperate X Displays.

With the current state of drivers AFAIK that would work only with nvidia binary drivers and maybe intel with kms and dri2...

On topic though I think alt+ TAB should just work, playing in windowed mode or on another X display is not a solution. Alt+TAB should simply just work.

poofyyoda
08-12-2009, 05:39 AM
With the current state of drivers AFAIK that would work only with nvidia binary drivers and maybe intel with kms and dri2...

Well, I actually almost exclusively use ATI cards, and 9.7 was the only driver I've used that has ever broken that usage. For that reason I just stayed on the 9.6 version, and hoping they get it sorted out for 9.8+.

Actually, I'm pretty sure it works on the opensource ATI driver also, but IIRC intel crashed on me, but that was when their driver was in a very sorry state. Though, I'm pretty sure that gamers won't be using intel graphics :)

NeoBrain
08-12-2009, 06:30 AM
http://www.alientrap.org/forum/viewtopic.php?p=44847&sid=32cb9514d74402e07042389724feca6b

This has been somewhat useful for me, esp. since it works for every game that supports windowed mode (which should cover 99% of existing apps).

The only problem seems to be fglrx, which keeps drawing the game's window even if it is minimized (worked once, but since 9.2 or something it does not). It does that also for the games, which support "real" minimizing, though...

M1AU
08-12-2009, 07:39 AM
+1
Please developers, don't grab our keyboard when playing fullscreen games on Linux.

Big thanks at this point to S2Games, which seems to handle alt+tab quite nicely in there games!

blablabla
08-12-2009, 12:29 PM
http://www.alientrap.org/forum/viewtopic.php?p=44847&sid=32cb9514d74402e07042389724feca6b

This has been somewhat useful for me, esp. since it works for every game that supports windowed mode (which should cover 99% of existing apps).

The only problem seems to be fglrx, which keeps drawing the game's window even if it is minimized (worked once, but since 9.2 or something it does not). It does that also for the games, which support "real" minimizing, though...

Looks like that is exactly what I put in the code to fix this for warsow: make a game windows and then let the windows manager set it fullscreen with _NET_WM_STATE_FULLSCREEN.
But it doesn't change the keyboard grabbing, you'll have to remove the xgrabkeyboard in the input code.

For those whodon't understand whati just wrote: It's very simple to fix this problem, with only a few changes to the source code of the game.

mirv
08-12-2009, 01:28 PM
Sometimes it's down to practicality - and may depend on the window manager. Mouse and keyboard grabs are there to redirect keyboard input to a game (this being somewhat useful). The mouse in particular will likely require a relative motion mode within the game to avoid limits on mouse motion.
I'm not sure how it goes these days, but the option of running in a windowed "fullscreen" mode may carry performance penalties that make it an undesirable approach. And I won't even get started on cross-platform problems with that too.
An in-game option or key combo to switch to windowed mode and release mouse/keyboard might be a better option.

yesterday
08-12-2009, 01:47 PM
The majority of Windows games stopped crashing while Atl+Tabbing after the Windows 98 days were over. That's not an issue anymore. I take it now for granted that I can task switch while a game is running. And when I can't, I'm pretty heavily annoyed.


The last few games I played on Windows did have problems with this.


Of course, me saying this is just as meaningless as your quoted statement

blablabla
08-12-2009, 01:58 PM
Sometimes it's down to practicality - and may depend on the window manager. Mouse and keyboard grabs are there to redirect keyboard input to a game (this being somewhat useful). The mouse in particular will likely require a relative motion mode within the game to avoid limits on mouse motion.
I'm not sure how it goes these days, but the option of running in a windowed "fullscreen" mode may carry performance penalties that make it an undesirable approach. And I won't even get started on cross-platform problems with that too.
An in-game option or key combo to switch to windowed mode and release mouse/keyboard might be a better option.

The mouse can be grabbed for a game, but should be ungrabbed when the game loses focus (after alt tab).
There is also a solution that doesn't involve mousegrabbing: mousewarping. This way the mouse wontleave the game since it will be warped back to the center

As for the second part of your post: I don't know how it was back in your days :D, but fullscreen or windowed shouldn't make much of a difference in performance.

gforum
08-12-2009, 02:46 PM
like said above, under linux we can just switch workspaces... thats what it's for anyways.
i get mine to some quick access shortcuts and all is well, when it ends well. :)

mirv
08-12-2009, 04:34 PM
The mouse can be grabbed for a game, but should be ungrabbed when the game loses focus (after alt tab).
There is also a solution that doesn't involve mousegrabbing: mousewarping. This way the mouse wontleave the game since it will be warped back to the center

As for the second part of your post: I don't know how it was back in your days :D, but fullscreen or windowed shouldn't make much of a difference in performance.

Fullscreen / windowed won't make much difference in games that don't need much power (by today's standards) but I'm not convinced that recent stuff will enjoy it. But hey, I could be wrong! Guess I'll have to test it out now.
In any case, I'm still of the opinion that important key events should be taken care of before they reach the game (for example, ctrl+alt+f[x] is never grabbed by any game, or even X, on my system); games shouldn't need to be aware of the window manager, though I agree they should be aware that something else may exist and be able to give control back to it easily.

trepo
08-13-2009, 04:02 AM
xorg.conf(5)

ServerFlags section

<...>

Option "AllowDeactivateGrabs" "boolean"
This option enables the use of the Ctrl+Alt+Keypad-Divide key sequence to deactivate any active keyboard and mouse grabs. Default: off.

<...>

thefirstm
08-13-2009, 06:01 AM
http://www.alientrap.org/forum/viewtopic.php?p=44847&sid=32cb9514d74402e07042389724feca6b

This has been somewhat useful for me, esp. since it works for every game that supports windowed mode (which should cover 99% of existing apps).

The only problem seems to be fglrx, which keeps drawing the game's window even if it is minimized (worked once, but since 9.2 or something it does not). It does that also for the games, which support "real" minimizing, though...

This method also works with most of the other games I play, like Sauerbraten and Tremulous. And the nvidia driver seems to have no problem with this method.

Mr. Anderson
08-27-2009, 07:48 AM
+1

Same thing with Warzone2100.