krasa / FrameSwitcher

IntelliJ plugin - https://plugins.jetbrains.com/plugin/7138?pr=idea
Apache License 2.0
39 stars 5 forks source link

Current project window does not stay focused #30

Open vsigler opened 3 years ago

vsigler commented 3 years ago

Hard to say if it is really caused by the plugin or some platform change, however, I started getting an issue that whenever I switch from Idea to another application and back, the focus switches to what seems like the last opened project. It also sometimes happens when closing modal or popup windows. In the past, it would happen sometimes, but very rarely. Nowadays when I've updated to the latest version, it happens much more often. Restarting the IDE seems to help until the problem happens again. Changing the force focus grab to -1 does not immediately fix the behavior. I'll see if keeping it as -1 after restart helps.

Idea version: IntelliJ IDEA 2020.3.1 (Ultimate Edition) Build #IU-203.6682.168, built on December 29, 2020 Runtime version: 11.0.9.1+11-b1145.63 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.16 GC: ParNew, ConcurrentMarkSweep Memory: 4012M Cores: 12 Registry: ide.mac.message.dialogs.as.sheets=false, ide.mac.file.chooser.native=false Non-Bundled Plugins: FrameSwitcher, PlantUML integration, org.mule.tooling.intellij.raml, org.jetbrains.kotlin, kotlintest-plugin-intellij, kotest-plugin-intellij, org.jetbrains.plugins.ruby, org.jetbrains.plugins.ruby-chef

krasa commented 3 years ago

I noticed something strange on Win 10 too, maybe the same thing, don't remember exactly. So I changed the switching to use https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/openapi/wm/impl/ProjectWindowAction.java#L108-L139 instead of a custom code - which is what is used for Main Menu | Window | <projects on the bottom> and Main Menu | Window | Next Project Window. Now it works fine for me.

Force focus grab does the same thing, only later.

Notice if the stealing window has a markdown preview or something similar... https://youtrack.jetbrains.com/issue/IDEA-241671

vsigler commented 3 years ago

In one case it had markdown, but more often just a random piece of code. Today I got an issue where invoking Navigate to Class/File would switch focus to the another project and do a lookup there. Interestingly enough, it disappeared after a while, possibly after indexing. Might or might not be related.

If I manage to find some pattern to it all, I'll try reporting to Jetbrains directly. It might be on their side just as well.