Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  OSX: stuck in full-screen after java exception  (Read 2508 times)
0 Members and 1 Guest are viewing this topic.
Offline arielm

Junior Member




which way to the station?


« Posted 2011-01-08 19:29:24 »

Usually, when running full-screen on OSX, it is always possible to leave the app by using cmd-Q.

The problem is when some uncaught Java exception occurs: cmd-Q is not working anymore and the only possibility I found to leave was to shut-down the machine.

Any clues?

Thanks,
Ariel
http://chronotext.org

Ariel Malka | www.chronotext.org
Offline lhkbob

JGO Knight


Medals: 32



« Reply #1 - Posted 2011-01-08 20:21:14 »

Catch your exceptions so that the execution of your program doesn't halt, or do something in your main method like:

1  
2  
3  
4  
5  
6  
7  
8  
// setup windows/fullscreen - which should also check for exceptions, but I won't go into that
try {
   while(true) {
      // do game, if quit requested break out of loop
  }
} finally {
  // tear down fullscreen
}

Offline arielm

Junior Member




which way to the station?


« Reply #2 - Posted 2011-01-08 20:42:54 »

The point here is not how to protect users from uncaught exception. It is more like: how to make a developer's life easier, in a world where unpredictable exceptions occur on a daily basis, while developing...

But I see your point: you mean that by putting the "main loop" inside try/catch should catch most of the exceptions and exit gracefully?
Ok, I accept it, but still I wonder what would happen if some exception take place inside another thread (e.g. some http stuff...)

And from a Jogl developer standpoint, it is strange at the first place that cmd-Q cease to work at some point.

Could it be related to the way LWJGL treats full-screen windows on OSX? (and to the point that no "system overlays" appear on top of the screen, e.g. when changing the Mac's volume?...)

Ariel Malka | www.chronotext.org
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Creativ

Senior Newbie





« Reply #3 - Posted 2011-01-08 20:45:06 »

I also had the problem a couple of times and just couldn't figure out how to get back to my desktop.
So I'm also looking for a keyboard-combo or something to close the Game. Maybe somebody has an Idea?


And since it also happens with Games from other people I can't change the code, so I'm looking for a way to close the Game without changing the Code. Smiley
Offline lhkbob

JGO Knight


Medals: 32



« Reply #4 - Posted 2011-01-08 23:51:55 »

There is a lot of weird things going on with Mac's and windowing.  When using LWJGL, I do not remember Cmd-Q ever working, I thought it was something that AWT added.  In my experience, most fullscreen games in Mac (such as WoW) don't respond to Cmd-Q when in fullscreen mode.

The point here is not how to protect users from uncaught exception. It is more like: how to make a developer's life easier, in a world where unpredictable exceptions occur on a daily basis, while developing...

Writing just a bit of code to exit gracefully will help with development and will be nicer for users at the same time, although stopping the exceptions would be best Smiley

Offline Mr. Gol

Senior Member


Medals: 1



« Reply #5 - Posted 2011-01-09 12:40:14 »

Actually, Apple provides an API for manually overriding what Command Q does. Take a look at http://developer.apple.com/library/mac/#documentation/Java/Reference/JavaSE6_AppleExtensionsRef/api/index.html . So you can just exit fullscreen mode when handling the quit event.
Offline arielm

Junior Member




which way to the station?


« Reply #6 - Posted 2011-01-09 13:07:08 »

Thanks, Mr. Gol, for the info but I'm not sure it is relevant.

Right now, the situation with LWJGL on OSX is that the application exits automatically when cmd-Q is pressed.
You don't have to code anything fancy for that, it behaves just like Alt-F4 on Windows...

The problem is when some uncaught exception occurs: cmd-Q is not working anymore.
I was hoping I could bring Eclipse's window to the front by using Alt-Tab, but no: I'm stuck in full-screen and the only way out is to turn off the Mac.

Right now, it seems like there is no magic-trick to solve that situation (i.e. without the need to do some preemptive exception catching...)

Ariel Malka | www.chronotext.org
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2011-01-09 13:21:27 »

When an uncaught exception occurs it's probably the case you accidentally leave your Cmd-Q processing loop and never actually leave the JVM. Not sure though, my Mac's dead so can't test :/
Remember in LWJGL, Cmd-Q is actually processed by you not by anything else. You have to explicitly detect it and call System.exit()

Cas Smiley

Offline arielm

Junior Member




which way to the station?


« Reply #8 - Posted 2011-01-09 13:47:25 »

Remember in LWJGL, Cmd-Q is actually processed by you not by anything else. You have to explicitly detect it and call System.exit()

Thanks, and well, it looks like I was not totally aware of this fact...
Part of digesting the LWJGL pill I guess Smiley

Ariel Malka | www.chronotext.org
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (17 views)
2014-07-30 21:08:39

Riven (23 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!