Masterticket: All issues related to window management
( SPARK-1228 )
[SPARK-1167]
Created: 10/18/10 Updated: 02/09/13 Resolved: 06/08/11
Status:
Project:
Closed
Spark
Component/s: General
Affects
Version/s:
2.6.0
Fix Version/s: 2.6.1
Type: Sub-task
Reporter:
Resolution: wroot
None
Fixed
Labels:
Attachments: 1167-focussteal.patch
Priority:
Votes:
Assignee:
Major
Wolf P.
1
MM_ChatContainer.txt
Issue Links: Related to is related to SPARK-1416 Update JRE to 7 version Closed is related to SPARK-948 Bring window to front shouldnt steal ... Closed
Description
I'm using 2.5.8 and 2.6.0 Beta 2 (first betas, with old skin) daily and i have never seen such behavior. But with the latest SVN version when Bring window to front is not enabled and Show toast popup is enabled. If you type in some other window and new messages arrives, then your current window loses focus. This happens only if toast popups are enabled. When not enabled, then new message just flashes in the taskbar and focus is not lost.
Comments
Comment by George Ashmore
[ 10/18/10 ]
This is close to what I am seeing, but I am actually seeing the issue regardless of if the toast popup is enabled or disabled (I am using the default settings which have this off, but I have tried both). If
Spark is in the system tray I loose focus. If it is not in the system tray, focus is retained.
Comment by wroot
[ 10/27/10 ]
Michael, i'm still able to reproduce this with the latest SVN version. And i will change the name of this ticket as toasts have nothing to do the indeed. Focus is lost when chat window appears in the taskbar. Michael, how are you testing this and on what OS? With Windows XP, you have to close all
Spark windows and it should only stay in systray. Then you start typing in some other app, then you should receive a message from another user (i'm doing this from other PC, so i don't have to do it on the same PC and won't affect focus with my own actions). When new chat window appears and starts flashing, then my previously active app's window becomes inactive (dims to the background). This doesn't happen if chat window was already opened before receiving new message.
Comment by Mike McMahon
[ 11/17/10 ]
I did some digging and found this to be a really old bug; however, it was addressed and "fixed."
If we override the setVisible(boolean) call and place a setFocusableWindowState(false) right before making the window visible and then calling setFocusableWindowState(true) right after then it successfully displays the chat window without stealing focus...the first time only however
Comment by Mike McMahon
[ 11/21/10 ] let me reiterate - a bug in java and how it requests for window focus =]
Okay - so i think i got this nailed down. If you compare the ChatContainer.java history versions
11763 11737 you will see a lot of changes were made (oddly a lot of dispose calls were removed, hope we are leaking memory in the background?)
Anyways line 479-484 are the important lines. chatFrame.setFocusableWindowState(false); and chatFrame.setFocusableWindowState(true); were removed in that build. If you add them back in then the windows will come to the front but not steal focus =]
I'm creating a patch now and attaching it =]
Comment by Mike McMahon
[ 11/21/10 ]
Attaching the fix for the focus stealing issue. Setting the window to be non focusable before bringing it into focus and then configuring it to be focusable after being brought to the front =] fixed for my local build.
Comment by wroot
[ 11/21/10 ]
I'm still having this issue with the first message received in Spark after its launch. It steals the focus, when chat window appears in the taskbar. But any subsequent received messages simply doesnt create a window in the taskbar. So nothing steals the focus then. I have described this in the Flashing ticket, that sometimes Spark is not creating chat window in the taskbar upon receiving new messages.
Now this is reproducable all the time, only the first message creates a window and if you close chat window, then it is not created anymore unless you restart Spark or open a chat window manually.
This is more annoying than not flashing issue, because you have no indication about the new messages at all. Unless you turn on showing new messages in the systray.
Comment by Mike McMahon
[ 11/21/10 ]
Hrmm, so i've found some more info about this bug which would explain why i thought my fix worked.
1) Start spark
2) Login with your usual JID
3) Allow spark to launch but DO NOT click on the roster or anyone on the transcript window
4) Open another program outside of the JVM (MSWord, notepad...etc)
5) from another location send the a message to the previously launched JID
In this instance the new chat window will not steal focus from the user; however, in step three if you click anywhere on the newly opened MainWindow and then open another program outside of the
JVM, the chat window will steal the focus.
Food for thought as I keep digging. I can reproduce this on my build consistently. Which also explains why I thought my code would fix this is as I was launching/logging into spark but not clicking on the MainWindow.
Comment by Wolf P.
[ 03/01/11 ] as a temporary workaround we could use the Robot class, since theres no Javamethod of getting the current Focus of the entire system to switch back. this patch serves fine on windows, since 1x "ALT+TAB" switches to the previously focused window, don't know about linux/mac though http://issues.igniterealtime.org/secure/attachment/11083/1167-focussteal.patch
Comment by Walter Ebeling
[ 03/27/11 ]
How about moving this patch to RC2 and get feedback from the testers on Linux ?
Comment by Wolf P.
[ 03/29/11 ] known Java Issue, theres a couple "workarounds" but none of those work
Comment by George Ashmore
[ 03/29/11 ]
Looks like we may have to wait for Java 7: http://download.oracle.com/javase/7/docs/api/java/awt/Window.html#setAutoRequestFocus(boolean)
Maybe we can assign this bug to a later version so it can be addressed once Java 7 is out of draft?
This is still my number 1 complaint about Spark.
Comment by Wolf P.
[ 03/29/11 ] tested setAutoRequestFocus(false) with lates java-7-beta, either not implemented, or not working
Comment by Jason
[ 06/07/11 ]
This has been a known bug since 2004... yes 7 years and no fix... really? I want to like Spark, I really do... but I'm being forced to migrate away from it since this has become too big of a problem around our office... It seriously interrupts the flow of business when you have execs having to rewrite letters and stuff since they stare at the keyboard while typing and realize it too late. This issue happens for us on ALL installations... using Spark 2.6.0 Build May 2011 on aboutu 30 machines... all have the same issue.
Comment by Walter Ebeling
[ 06/07/11 ]
There has been an extensive research on this http://community.igniterealtime.org/message/213161#213161 but no resolution until now.
Comment by Wolf P.
[ 06/08/11 ]
Completed: At revision: 12460
Comment by Walter Ebeling
[ 06/22/11 ]
Mass closing of all bugs resoved during 2.6.0 and 2.6.1
Comment by Chris Burcham
[ 05/01/12 ]
If this is an issue with how Java handles the focus, are there any specific Java versions that don't cause this problem? Several of my co-workers have stopped using the messenger because it steals focus away from what they're typing. I really like Spark and don't want to support a different client.
Most of our PCs run XP SP3 with a recent version of Java 6. Everyone is on Spark 2.6.3. Does the beta address this issue? We use the FastPath plugin. Does the beta play well with FastPath?
Comment by wroot
[ 05/02/12 ]
Java 7 doesn't have such issue, but current Spark version won't work with Java 7 installed separately.
You have to copy Java 7 jre folder to Spark folder. I think i have tried this myself and it didn't work
for me. I'm using 2.6.3 and sometimes it does steal focus, but usually just with some apps like
Outlook, not with every.
Comment by George Ashmore
[ 05/02/12 ]
I have had no issues with focus stealing since updating to Java 7 on my own builds. The current online version of the beta seems to balk at Java 7, however, my own build using innosetup doesn't seem to give me any problems.
Comment by Chris Burcham
[ 05/18/12 ]
Ok, I tested a successful configuration. If I uninstall all java 6 and older versions, I can get it to not lose focus after installing the 2.7 beta. I'm going to do some testing with a small group before deploying the beta. I'll let you guys know how it goes. Thank you.
Comment by Youngmin Kim
[ 01/30/13 ]
I installed Spark 2.6.3_12555(1/8/2013) with Java 7 on Windows XP Pro. XP Home. Windows 7
Pro.
On Windows 7 Pro, It doesn't steal focus from other apps when receiving new message.
But on Windows XP Home and Pro, Spark steals the focus from other apps like notepad, wordpad when receiving new message.
Is this issue already perfectly solved?
Do I have to do anthing more to solve this problem?
Comment by Chris Burcham
[ 01/30/13 ]
Be sure no other versions of Java are on the XP machines. The only way I was able to resolve the issue was by running Java 7 alone. If Java 6 gets reinstalled, the window focus breaks again.
Comment by Walter Ebeling
[ 02/09/13 ]
The stealing problem is related to the 1.6. jre. It is not fixable in Spark (at leat to my knowledge). I would always recomment to use the Spark installation that includes the JRE. The JRE updates in the operation system may make sense for security updates of the Java browser runtime. For applications it is not a good practice to use the OS wide JRE. The JRE updates break applications very easy and it in common. As a side note: JRE 1.6.0_39 broke a commercial application at my company with high impact to operation. 1.6.0_25 and higher broke the feature that Spark can react to a system shutdown.
The resolution for Spark: Update the JRE included in the Spark full install to Java 7 and you are fine.
Generated at Mon Mar 07 03:50:10 CST 2016 using JIRA 7.0.10#70120sha1:37e3d7a6fc4d580639533e7f7c232c925e554a6a.