Jump to content


Photo

A patch to allow alt-tabbing under Linux


  • Please log in to reply
11 replies to this topic

#1 NagaHuntress

NagaHuntress

    Member

  • Member
  • PipPip
  • 39 posts

Posted 29 July 2015 - 06:42 PM

I've created a patch to fix the problem where it was impossible alt-tab (or use any other window manager key combos) to switch away from TDM. This patch works for both windowed and full screen modes.

Attached File  tdm-linux-window-manager-key-fix.txt   6.5KB   16 downloads
 

Changes:
 - It will no longer grab exclusive input of the keyboard by default. This allows the window manager to process the keyboard input and do things like alt-tabbing. To get the old behaviour set 'in_grabkeyboard' to 1 (Exception: Full screen console will now ungrab, previously only windowed console would ungrab.).
 - In order to get the above behaviour to work in full screen mode, full screen mode initialisation has been modified so that it asks the window manager to handle the window as a full screen window. To get the old behaviour set 'v_nowmfullscreen' to 1 (this will force it to grab the keyboard input too, regardless of 'in_grabkeyboard' or other conditions).


I've only tested it on Linux Mint 17.2, 64 bit.

 


  • OrbWeaver, Bikerdude, jaxa and 1 other like this

#2 SteveL

SteveL

    Hero Coder

  • Active Developer
  • PipPipPipPip
  • 3669 posts

Posted 30 July 2015 - 10:09 AM

Thanks for the patch!  This would be something useful we could do for Windows users too.

 

Please open a bugtracker and attach the patch. Do we have any other Linux users building their own TDM right now who can confirm the fix? You can assign the tracker to me in the meantime. If no-one steps forward to build and test it immediately, we can still include it for testing in the next packaged version, which covers both platforms.


  • Bikerdude likes this

#3 NagaHuntress

NagaHuntress

    Member

  • Member
  • PipPip
  • 39 posts

Posted 30 July 2015 - 11:16 AM

I''ve gone and submitted it to the bugtracker.   I have no power to assign the bug to you, so you or someone lese will need to do that.



#4 NagaHuntress

NagaHuntress

    Member

  • Member
  • PipPip
  • 39 posts

Posted 09 August 2015 - 08:43 PM

After some test, I've found that the games doesn't let go of the mouse when it loses focus due to alt tabbing, however, switching workspaces via the keyboard does work to force it to let go. It needs to be modified further so that it will let go of the mouse when it loses focus.

I've also tested it on Ubuntu 12.04 and it performs the same.



#5 SteveL

SteveL

    Hero Coder

  • Active Developer
  • PipPipPipPip
  • 3669 posts

Posted 10 August 2015 - 10:03 AM

Ok, shall I hold off on committing your patch until you say? 

 

The only reason I didn't commit it right away is I couldn't test it myself. I was looking for another Linux user who builds their own to test it. But I haven't found a volunteer so we‘ll test it with the rest of 2.04, which will remove the "build it yourself" requirement.



#6 NagaHuntress

NagaHuntress

    Member

  • Member
  • PipPip
  • 39 posts

Posted 10 August 2015 - 11:58 PM

Even with the bug I've mentioned, I find being to alt-tab out of game immensely useful. So, in that respect I'm for putting the patch in as is, but I can certainly understand on holding off until it's of better quality.

 

Regardlees, I'll try and work on a better version of this patch as time permits.



#7 NagaHuntress

NagaHuntress

    Member

  • Member
  • PipPip
  • 39 posts

Posted 11 August 2015 - 05:09 AM

Okay, I've added 'in_grabmouse' to make the mouse grab behaviour like that of the keyboard's. This will fix the bug where it won't let go of the mouse on loss of focus.

 

It's not the proper fix where it grabs and ungrabs based on focus being gained and lost respectively, but it should work well enough for now. It might have problems if the mouse moves fast enough to escape the window before it moves the cursor back to center.

The diff is up on the bug tracker. #4190



#8 SteveL

SteveL

    Hero Coder

  • Active Developer
  • PipPipPipPip
  • 3669 posts

Posted 11 August 2015 - 09:09 AM

Thanks very much. To be clear, I was only waiting for the nod from you to say you'd done working on it for now.

The small chance of a bug in the circs you describe is much less impact than the current situation, that locks the mouse to the game all the time.

#9 GilGiy

GilGiy

    Newbie

  • Member
  • Pip
  • 4 posts

Posted 27 May 2016 - 08:46 PM

Stupid question but how do I use this?



#10 AluminumHaste

AluminumHaste

    Darkmod Contributor

  • Development Role
  • PipPipPipPipPip
  • 5614 posts

Posted 07 June 2016 - 09:42 AM

Okay, I've added 'in_grabmouse' to make the mouse grab behaviour like that of the keyboard's. This will fix the bug where it won't let go of the mouse on loss of focus.

 

It's not the proper fix where it grabs and ungrabs based on focus being gained and lost respectively, but it should work well enough for now. It might have problems if the mouse moves fast enough to escape the window before it moves the cursor back to center.

The diff is up on the bug tracker. #4190

 

If you're on Windows, bringing down the console (CTRL+ALT+~) will allow the mouse to function as normal in Windows.


I always assumed I'd taste like boot leather.

 

#11 i30817

i30817

    Member

  • Member
  • PipPip
  • 447 posts

Posted 16 March 2017 - 01:10 PM

This isn't fixed is it?



#12 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 7530 posts

Posted 16 March 2017 - 01:13 PM

Alt Tab is working well in Windows. The Linux patch has not yet been merged and tested.


Please visit TDM's IndieDB site and help promote the mod:

http://www.indiedb.c...ds/the-dark-mod

(Yeah, shameless promotion... but traffic is traffic folks...)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users