In looking into this again, I'm not able to reproduce it on purpose yet. Do you have a method to cause it?
Relatedly, I notice that if you have two canvas windows open and right click to open the menu on the NON-focused canvas, the menu still refers to the active canvas window. I think is is a bug and the expected behavior should be to either:
* only open menu when over focused canvas window
* focus canvas window under mouse and then open menu
I think think this might b related as I've seen the window click bug happen mainly when I'm doing lots of multi-level subpatch, GOP, and GUI editing.
As a short follow up, restarting Pd makes the issue disappear. I'm moving back and forth between patch windows as expected, so it seems this is a bug where the current window gets out of sync between the core and the GUI.
Roman, you were right in that there is weird behavior with the new Tk where it seems you need to click multiple times in order to switch window focus. I've noticed that right click on one patch window is still referring to the previous window. Clicking on the window titlebar then shifts the focus. I'm wondering if this is something we can catch in the GUI or something wrong with Tk itself.