Articles about linux, tech, etc


Fixing openbox focus requests on click(primarily for minecraft classic/in[f]dev)

So there's this issue I've had with minecraft when trying to play indev, but it also occurs on infdev and classic. I'm sure this affects other games and software aswell however. Whenever I tried to click, mouse button 1, 2, or 3, the game pauses, essentially as if it was bound to escape. This is obviously a nuisance that makes it near unplayable.

In minecraft classic this manifests as the pause screen, sometimes before, sometimes after, the normal action. In minecraft indev, older versions work as it did not detect the focus change, for example in-20100125-2, however later versions of indev would exit to menu after a world was generated. On infdev it's back to pausing. I'm sure this affects other versions aswell in some way.

So I was doing some searching in an attempt to fix this issue, and eventually found this, which again does not directly help, but links to specifically for linux. In the solution it doesn't help, but the comments list X as stealing focus.

I decided to to try in window managers with likely more rudimentary focus systems, dwm and fvwm, as the focus most likely wouldn't be stolen. To my surprise, it worked perfectly under them. So I had to figure out why it didn't in openbox. I checked rc.xml, and found on every click on the Client context(the window), it ran a focus and a raise command. Course if it's sending a focus request on every click, then a rudimentary system like older minecraft would have would process a focus change as probably another window, because well, why would you focus the already focused window? So I commented it out as such:

and then I tried running it again, and... it works!

Of course most people don't have sloppyfocus enabled, so I properly rewrote it as per normal functionality.

This will act exactly the same, except it wont send unnecessary extra focus requests, which fixes the pause on click issues. As for me, I'm used to alt-clicking to raise from fvwm, so I just completely deleted the Client context.