I am developing a Photoshop Panel using the CS Flex SDK 3.4.0 which uses CSXSInterface.evalScript() to communicate with an Automate plugin. Sometimes this panel starts a timer to call use evalScript() to call a function in the plugin.
I have noticed that when the timer fires evalScript(), if the user is dragging or resizing any Photoshop window, the window snaps back to its original size and position. It is only possible to move or resize a window if evalScript() is not called at any time during the move/resize. At first I thought that the timer fires infrequently enough that this wouldn't be a large deal, but after testing for about a week, it happens more often than I'd like, and my testers find it extremely frustrating when it happens even once.
I'm developing on Mac using Photoshop CS5, but will be supporting both CS5 and CS5.5 on both Mac and Win before release. The panel doesn't work properly on Windows yet, so I don't know if this bug exists in Windows PS.
I have searched for a result for the past few days, and come up empty. At this point, I'm looking for one of the following solutions:
1. Some way to stop CSXSInterface from yanking the window out from under the user. E.g., is there some property I'm not setting on the CSXSInterface shared instance that would fix this bug?
2. Some way to determine if the user is holding down the mouse button anywhere on the screen. Right now I can only receive MOUSE_DOWN events when the mouse is over my panel, and I can't find a way to poll the mouse for its button state. If I knew that the mouse button was down, I could assume that the user might be dragging a window and reset the timer.
3. Some other way of communicating with an Automate plugin. I experimented with using a socket connection between the panel and the plugin, but the automate plugin is run by the Photoshop plugin, and I can't find a way to get Photoshop to run code in the plugin at regular intervals (to receive and process socket data). If there was some kind of function I could expose to PS to call on a regular basis, I could use an alternate IPC.
Thank you for your time and advice!
I apologize for the double-post, but I have now tested the panel in Windows, and the bug is even worse. My panel has a couple text boxes, and if the user is typing in one of them when the timer fires, the text box loses focus and the user's keystrokes are interpreted as Photoshop keyboard shortcuts.