log.debug("refCount.inc=" + rc);
if (initialize) {
fbDevice = (JNodeFrameBufferDevice) GraphicsEnvironment
.getLocalGraphicsEnvironment().getDefaultScreenDevice();
if (fbDevice == null) {
throw new AWTError("No framebuffer fbDevice found");
}
log.info("Supported graphics configurations: ");
GraphicsConfiguration[] configurations = fbDevice.getConfigurations();
for (GraphicsConfiguration g_conf : configurations) {
log.info(g_conf);
}
String screen_size = AccessController.doPrivileged(new GetPropertyAction("jnode.awt.screensize", "none"));
if ("none".equals(screen_size)) {
config = (JNodeGraphicsConfiguration) fbDevice.getDefaultConfiguration();
} else {
boolean found = false;
for (GraphicsConfiguration g_conf : configurations) {
if (screen_size.equals(g_conf.toString())) {
config = (JNodeGraphicsConfiguration) g_conf;
found = true;
break;
}
}
if (!found) {
config = (JNodeGraphicsConfiguration) fbDevice.getDefaultConfiguration();
}
}
log.info("Using: " + config);
this.api = fbDevice.getAPI();
try {
log.debug("Opening AWT: Using fbDevice " + fbDevice.getIDstring());
api.requestOwnership(this);
this.graphics = api.open(config.getConfig());
if (graphics == null) {
log.debug("No Graphics for fbDevice: " + fbDevice.getIDstring());
return rc;
}
graphicsMode = true;
screenSize.width = config.getConfig().getScreenWidth();
screenSize.height = config.getConfig().getScreenHeight();
//drawStartupScreen();
final EventQueue eventQueue = getSystemEventQueueImpl();
this.keyboardHandler = new KeyboardHandler(eventQueue);
this.mouseHandler = new MouseHandler(fbDevice.getDevice(),
screenSize, eventQueue, keyboardHandler);
keyboardHandler.install();
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
onInitialize();
return null;
}
});
this.refCount = rc;
} catch (DeviceException ex) {
decRefCount(true);
throw (AWTError) new AWTError(ex.getMessage()).initCause(ex);
} catch (UnknownConfigurationException ex) {
decRefCount(true);
throw (AWTError) new AWTError(ex.getMessage()).initCause(ex);
} catch (AlreadyOpenException ex) {
decRefCount(true);
throw (AWTError) new AWTError(ex.getMessage()).initCause(ex);
} catch (Throwable ex) {
decRefCount(true);
log.error("Unknown exception", ex);
throw (AWTError) new AWTError(ex.getMessage()).initCause(ex);
}
}
return rc;
}