JDK-8074668 : [macosx] Mac 10.10: Application run with splash screen has focus issues
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u40,9
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2015-03-08
  • Updated: 2017-11-27
  • Resolved: 2015-03-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b59Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.10 (yosemite).

A DESCRIPTION OF THE PROBLEM :
Applications started through webstart cannot get keyboard focus. They don't appear in the dock, nor in the 'Force Quit' dialog. 

For example, you cannot get a cursor in JTextField.

ADDITIONAL REGRESSION INFORMATION: 
I upgraded my macbook air from 10.9 to 10.10 because customers reported this issue. I had no problems on 10.9, but I am not sure which version of java I was using.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start any webstart application that has a text field or any UI component that should respond to the keyboard. Hit any key and it will be sent to a different application. There appears to be no way to get the java application to focus.

For example, https://docs.oracle.com/javase/tutorialJWS/samples/deployment/customprogress_webstartJWSProject/customprogress_webstart.jnlp. After the table loads, you can double-click on the first column to edit a cell, but you can't get any text in.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Application should appear in dock and receive keyboard events.
ACTUAL -
Application does not appear in the dock, and does not receive keyboard events.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
None found.


Comments
Regression test was added in JDK-8075244, see /test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
19-10-2015

release-note: Area: client-libs/java.awt Synopsis: Mac 10.10: Application run with splash screen has focus issues Applications started through webstart or standalone applications , which use splashscreen, cannot get keyboard focus. Workaround: Launch javaws using the -Xnosplash option.
12-03-2015

Review request: http://mail.openjdk.java.net/pipermail/2d-dev/2015-March/005181.html
12-03-2015

As a fix I suggest to disable functionality which was added in JDK-8049198 and JDK-8043869. BEcause if I try to revert them back i should change more files Suggested fix: src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m @@ -129,15 +129,11 @@ char* SplashGetScaledImageName(const char* jar, const char* file, float *scaleFactor) { NSAutoreleasePool *pool = [NSAutoreleasePool new]; *scaleFactor = 1; char* scaledFile = nil; - __block float screenScaleFactor = 1; - - [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - screenScaleFactor = [SplashNSScreen() backingScaleFactor]; - }]; + float screenScaleFactor = 1; if (screenScaleFactor > 1) { NSString *fileName = [NSString stringWithUTF8String: file]; NSUInteger length = [fileName length]; NSRange range = [fileName rangeOfString: @"." jprt build: http://scaaa637.us.oracle.com/archive/2015/03/2015-03-12-001854.serb.jdk8-gate/bundles/
12-03-2015

The problem occurs after we call NSScreen.backingScaleFactor on a Appkit Thread. NOte that it seems that it was working as expected when the fix was integrated, but now it can hang or have another artifacts.
11-03-2015

This is a regression of JDK-8049198.
11-03-2015

Also happens with 9 ea builds, which may be easier to debug on Yosemite
11-03-2015

I confirmed it happens when running "java -jar SwingSet2.jar", reassigning to client-libs for further investigation
11-03-2015

Splash screen related changes in b15 and b16 are: JDK-8049198 and JDK-8043869
11-03-2015

SwingSet2.jar does not get focus not only when run as jnlp. It also doesn't get focus when run as jar file (double click on jar). When I removed the following line from manifest: SplashScreen-Image: resources/images/splash.png it works great! So, problem is in splash screen. Without splash screen SwingSet2 demo works when it runs as jar & as jnlp.
11-03-2015

Same problem with b17 and above. b13, b14 - OK. WebStart Application gets focus correctly but with same stacktrace. So, problem may be not illustrated by this stacktrace. Problem is introduced in b15 or b16. (Installer for b15 and b16 does not work)
11-03-2015

I see the following output in Java Console: Java Web Start 11.40.2.26 Using JRE version 1.8.0_40-b26 Java HotSpot(TM) 64-Bit Server VM User home directory = /Users/gtee ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack 0-5: set trace level to <n> ---------------------------------------------------- Missing Permissions manifest attribute in main jar: http://download.java.net/javadesktop/swingset3/SwingSet3.jar session restoration temporarily disabled Mar 11, 2015 10:34:06 PM org.jdesktop.application.Task failed SEVERE: org.jdesktop.application.Application$DoWaitForEmptyEventQ@65f3ec6d failed: java.security.AccessControlException: access denied ("java.awt.AWTPermission" "accessEventQueue") java.security.AccessControlException: access denied ("java.awt.AWTPermission" "accessEventQueue") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457) at java.security.AccessController.checkPermission(AccessController.java:884) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at com.sun.javaws.security.JavaWebStartSecurity.checkPermission(Unknown Source) at java.awt.Toolkit.getSystemEventQueue(Toolkit.java:1719) at org.jdesktop.application.Application.waitForEmptyEventQ(Application.java:383) at org.jdesktop.application.Application.access$200(Application.java:126) at org.jdesktop.application.Application$DoWaitForEmptyEventQ.doInBackground(Application.java:406) at org.jdesktop.application.Application$DoWaitForEmptyEventQ.doInBackground(Application.java:403) at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.jdesktop.swingworker.SwingWorker.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
11-03-2015

Unable to switch focus in SwingSet2. 1. Choose JTable demo. 2. Click on any control. 3. Try to tab out. Escape in list box also does not work.
11-03-2015

On 11.03.2015 21:42, dmitriy.gubkin@oracle.com wrote: > Hi, > issue is reproducible. > Tried MacOS 10.10 + 8u40 b26. > > Tests: > 1. http://stt-13.ru.oracle.com:8080/JavawsMustangIntegTest/jdk1.8.0_40/demo/jfc/SwingSet2/SwingSet.jnlp ( need to choose JTable subdemo and try to edit Header/Footer field. > 2. https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/InputVerificationDemoProject/InputVerificationDemo.jnlp - can't input data into input fields > > Notes: > 1. All input appears in text console where javaws is started. > 2. javaws -Xnosplash solves an issue. > 3. No issue for swingset started in browser on Mac as an applet ( http://stt-13.ru.oracle.com:8080/JavawsMustangIntegTest/jdk1.8.0_40/demo/jfc/SwingSet2/SwingSet.html ) > 4. No issue on Windows > > Thanks, Dmitriy.
11-03-2015

SQE is able to reproduce the bug on 8u40 Mac 10.10.
11-03-2015

*********************************************************************************************************** Checked this on Windows 7 (JDK 8u40) and the application loaded fine. Was able to run the example from the report with ability to edit the fields. Though received an exception in the Java console: Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException at customprogressindicator.CustomProgress$2.run(CustomProgress.java:90) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) ************************************************************************************************************ Plan: To test Mac OS X 10.10 (Yosemite).
09-03-2015