If application window is in focus when breakpoint is hit, keyboard and mouse focus will not shift to any other window
Answered
Running IntelliJ IDEA 2019.3.2 on Fedora 31 Linux. Issue persists on gnome, Xcfe, and KDE desktop environments. The application I am debugging is a game, so the mouse cursor disappears when it is in focus. When I trigger the breakpoint the game will freeze. I can alt tab into other windows, but my mouse cursor is gone and windows I alt tab into wont receive keyboard input either. The only way to restore focus is to alt tab into the game window and press alt+f4 to force exit. This isn't an issue if the game is not in focus when the breakpoint is hit. Not sure what could be causing this issue but its annoying because I can't debug the game right now.
Any ideas? Thanks.
Please sign in to leave a comment.
I recorded a video of the problem in case my description was hard to follow. https://l.trs.tn/RaPzelQ2yoAb.mp4
Hi,
> I can alt tab into other windows, but my mouse cursor is gone and windows I alt tab into wont receive keyboard input either.
Am I getting right that the cursor disappears completely for all applications, not only in IntelliJ?
Yes, that is correct. I would also like to make a correction: keyboard input to other windows does work, its just the mouse that is gone. Using hotkeys I can sort of restore mouse functionality by pressing F9 (resume program) until the next game tick, which I assume runs code that tells GLFW the window isn't in focus anymore. I might be able to 'fix' this issue by manually running that code before every breakpoint. Is that possible with IntelliJ?
The only option within IDE that may be a possible workaround is the following, please check if it helps:
1. Press `Help | Edit Custom Properties...` (if a dialog appears, press "Create")
2. "idea.properties" file will open. Add the following lines:
suppress.focus.stealing.active.window.checks=true
suppress.focus.stealing.disable.auto.request.focus=true
3. Restart IDE
Sorry for bumping this old thread. I got an email from somebody who has the same issue, so I will post my 'fix' here for those who stumble upon this thread in the future.
Paste this code into a class and call it in your breakpoints condition field
This will restore the mouse cursor, but it will ONLY work on the games main thread. If you breakpoint another thread, make sure you suspend only that thread and not all threads.
Still having this exact same issue with CLion Arch Linux in 2022..
@tayst this seems to be related to IDEA-227594. Please leave a comment in that ticket with info requested in its description. Please also specify the steps leading to the issue in your case. Thank you!
Sorry for the bump. If anyone else is having the above problem on Linux, putting this into breakpoint conditions solved the issue:
hope it'll help someone. It was inspired by the above suggestion, but it just didn't work for me. This modified version does. Cheers!
Right-click the breakpoint and select ‘suspend thread’ instead of ‘all’ will also resolve the issue.