Jump to content
The Dark Mod Forums

A patch to allow alt-tabbing under Linux


NagaHuntress

Recommended Posts

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.

tdm-linux-window-manager-key-fix.txt

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.

  • Like 3
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 9 months later...
  • 2 weeks later...

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.

 

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...