Home » jAlbum forums » Bug reports

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 7 - Pages: 1 - Last Post: 08-Nov-2012 02:43 Last Post By: Vermillion002
Vermillion002

Posts: 4
Registered: 10/26/12
Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 26-Oct-2012 06:18
 
  Click to reply to this thread Reply
Hello,

I noticed in the release notes for 10.10.6 that there were several fixes for Java 7 compatibility on the Mac, including "Keyboard support wasn't working when running the full screen slide show on Mac and Java 7".

I'm hoping that one of the JAlbum developers could provide some information as to what the fix actually was, to the benefit of the Mac Java development community.

I have run into a similar issue with keyboard input on Java 7 that wasn't present with Java 6 on OS X. I have posted a detailed question over on StackOverflow:

FullScreen Swing Components Fail to Receive Keyboard Input on Java 7 on Mac OS X Mountain Lion

Any additional information will be greatly appreciated.

Thank you.
davidekholm

Posts: 18,861
Registered: 10/18/02
Re: Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 26-Oct-2012 10:35   in response to: Vermillion002 in response to: Vermillion002
 
  Click to reply to this thread Reply
Hi. I simply avoided calling
getGraphicsConfiguration().getDevice().setFullScreenWindow(this);
where "this" is the window where we run full screen slide shows. This means we don't get rid of the Mac menu bar when running slide shows on Mac+Java7 right now, but it's a workable workaround until Oracle has fixed this. I have reported the problem to Oracle.
Vermillion002

Posts: 4
Registered: 10/26/12
Re: Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 26-Oct-2012 19:18   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Thank you for the rapid response. It looks like we're in the same position. It's most unfortunate that there doesn't seem to be a resolution for the time being.

I've scoured bugs.sun.com to come up with an existing issue that covers what we've been seeing, but I've had no luck.

Could you please post a link to the Oracle issue you created? Thanks!

And I will of course post back here any workarounds that I can come up with.

Edited by: Vermillion002 on 26-Oct-2012 19:18
davidekholm

Posts: 18,861
Registered: 10/18/02
Re: Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 29-Oct-2012 18:55   in response to: Vermillion002 in response to: Vermillion002
 
  Click to reply to this thread Reply
The bug has been filed as JDK-8000102 by Oracle
davidekholm

Posts: 18,861
Registered: 10/18/02
Re: Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 01-Nov-2012 09:11   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Update from Oracle:

3. JDK-8000276/JDK-7175707 has been fixed in JDK 8 and backport on 7u12(#JDK-8001126), please verify the fix on next available build.

7u12 b01 shall be available next week. Keep you closely posted.
Vermillion002

Posts: 4
Registered: 10/26/12
Re: Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 01-Nov-2012 21:21   in response to: Vermillion002 in response to: Vermillion002
 
  Click to reply to this thread Reply
Great news! Hopefully the Oracle update does indeed clear this issue up.

In the meantime, I have been experimenting with the new FullScreenUtilities classes that provide for greater integration with the OS X experience. If you're not looking to have a kiosk-like experience (no Command-Tab app switching, LaunchPad, MissionControl, etc.), then this might provide a better path for your application. These classes work on Mac OS X 10.7.1 and Java 7u4 and above (at least, that was my earliest test platform).

Instead of the call to
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);

you would initially call this a single time on your frame
enableOSXFullscreen(frame);

and then this whenever you wanted to enter or exit fullscreen mode
toggleOSXFullscreen(frame);


I implemented it using reflection so that this will compile across platforms. The original StackOverflow question has the complete code update, but here are the methods for convenience:

	/**
	 * Hint that this Window can enter fullscreen.  Only need to call this once per Window.
	 * @param window
	 */
	@SuppressWarnings({"unchecked", "rawtypes"})
	public static void enableOSXFullscreen(Window window) {
		try {
			Class util = Class.forName("com.apple.eawt.FullScreenUtilities");
			Class params[] = new Class[]{Window.class, Boolean.TYPE};
			Method method = util.getMethod("setWindowCanFullScreen", params);
			method.invoke(util, window, true);
		} catch (ClassNotFoundException e1) {
		} catch (Exception e) {
			System.out.println("Failed to enable Mac Fullscreen: "+e);
		}
	}


	/**
	 * Toggle OSX fullscreen Window state. Must call enableOSXFullscreen first.
	 * Reflection version of: com.apple.eawt.Application.getApplication().requestToggleFullScreen(f);
	 * @param window
	 */
	@SuppressWarnings({"unchecked", "rawtypes"})
	public static void toggleOSXFullscreen(Window window) {
		try {
			Class appClass = Class.forName("com.apple.eawt.Application");
 
			Method method = appClass.getMethod("getApplication");
			Object appInstance = method.invoke(appClass);
 
			Class params[] = new Class[]{Window.class};
			method = appClass.getMethod("requestToggleFullScreen", params);
			method.invoke(appInstance, window);
		} catch (ClassNotFoundException e1) {
		} catch (Exception e) {
			System.out.println("Failed to toggle Mac Fullscreen: "+e);
		}
	}
davidekholm

Posts: 18,861
Registered: 10/18/02
Re: Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 02-Nov-2012 11:58   in response to: Vermillion002 in response to: Vermillion002
 
  Click to reply to this thread Reply
Thanks for passing that code!
Vermillion002

Posts: 4
Registered: 10/26/12
Re: Details on the FullScreen keyboard input issue with Java 7 on Mac OS X?
Posted: 08-Nov-2012 02:43   in response to: Vermillion002 in response to: Vermillion002
 
  Click to reply to this thread Reply
And we now have a workaround until the bug is fixed (thanks to Leonid Romanov at Oracle). Details are in the original StackOverflow thread, but it boils down to toggling visibility:

dev.setFullScreenWindow(frame);
frame.setVisible(false);
frame.setVisible(true);


I still have some issues in a larger application context, but this may work fine for you.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums