protected native void eventThread();
private native void natInit();
- /** returns the $BROWSER environment variable, since System.getEnv() is useless */
- private static native String getEnv(String key);
-
+ /** returns the value of the environment variable key, or null if no such key exists */
+ protected native String _getEnv(String key);
+
/** spawns a process which is immune to SIGHUP */
private static native void spawnChildProcess(String[] command);
- protected synchronized HTTP.ProxyInfo _detectProxy() {
-
- HTTP.ProxyInfo ret = new HTTP.ProxyInfo();
-
- ret.httpProxyHost = getEnv("http_proxy");
- if (ret.httpProxyHost != null) {
- if (ret.httpProxyHost.startsWith("http://")) ret.httpProxyHost = ret.httpProxyHost.substring(7);
- if (ret.httpProxyHost.endsWith("/")) ret.httpProxyHost = ret.httpProxyHost.substring(0, ret.httpProxyHost.length() - 1);
- if (ret.httpProxyHost.indexOf(':') != -1) {
- ret.httpProxyPort = Integer.parseInt(ret.httpProxyHost.substring(ret.httpProxyHost.indexOf(':') + 1));
- ret.httpProxyHost = ret.httpProxyHost.substring(0, ret.httpProxyHost.indexOf(':'));
- } else {
- ret.httpProxyPort = 80;
- }
- }
-
- ret.httpsProxyHost = getEnv("https_proxy");
- if (ret.httpsProxyHost != null) {
- if (ret.httpsProxyHost.startsWith("https://")) ret.httpsProxyHost = ret.httpsProxyHost.substring(7);
- if (ret.httpsProxyHost.endsWith("/")) ret.httpsProxyHost = ret.httpsProxyHost.substring(0, ret.httpsProxyHost.length() - 1);
- if (ret.httpsProxyHost.indexOf(':') != -1) {
- ret.httpsProxyPort = Integer.parseInt(ret.httpsProxyHost.substring(ret.httpsProxyHost.indexOf(':') + 1));
- ret.httpsProxyHost = ret.httpsProxyHost.substring(0, ret.httpsProxyHost.indexOf(':'));
- } else {
- ret.httpsProxyPort = 80;
- }
- }
-
- ret.socksProxyHost = getEnv("socks_proxy");
- if (ret.socksProxyHost != null) {
- if (ret.socksProxyHost.startsWith("socks://")) ret.socksProxyHost = ret.socksProxyHost.substring(7);
- if (ret.socksProxyHost.endsWith("/")) ret.socksProxyHost = ret.socksProxyHost.substring(0, ret.socksProxyHost.length() - 1);
- if (ret.socksProxyHost.indexOf(':') != -1) {
- ret.socksProxyPort = Integer.parseInt(ret.socksProxyHost.substring(ret.socksProxyHost.indexOf(':') + 1));
- ret.socksProxyHost = ret.socksProxyHost.substring(0, ret.socksProxyHost.indexOf(':'));
- } else {
- ret.socksProxyPort = 80;
- }
- }
-
- String noproxy = getEnv("no_proxy");
- if (noproxy != null) {
- StringTokenizer st = new StringTokenizer(noproxy, ",");
- ret.excluded = new String[st.countTokens()];
- for(int i=0; st.hasMoreTokens(); i++) ret.excluded[i] = st.nextToken();
- }
-
- if (ret.httpProxyHost == null && ret.socksProxyHost == null) return null;
- return ret;
- }
-
protected void _newBrowserWindow(String url) {
String browserString = getEnv("BROWSER");
if (browserString == null) {
// use the font list to build nativeFontList
String[] fonts = listNativeFonts();
+ Vector v = new Vector();
for(int k=0; k<fonts.length; k++) {
+
String s = fonts[k].toLowerCase();
- StringTokenizer st = new StringTokenizer(s, "-", false);
- String[] font = new String[st.countTokens()];
-
+ String s2 = s;
try {
- for(int i=0; st.hasMoreTokens(); i++) font[i] = st.nextToken();
+ v.setSize(0);
+ s = s.substring(s.indexOf('-') + 1);
+ while (s.indexOf('-') != -1) {
+ v.addElement(s.substring(0, s.indexOf('-')));
+ s = s.substring(s.indexOf('-') + 1);
+ }
+ v.addElement(s);
+ String[] font = new String[v.size()];
+ v.copyInto(font);
// limit to iso8559 until we can do I18N properly....
- if (font.length > 13) {
- if (!font[13].equals("iso8559")) continue;
- if (font.length < 15 || !font[14].equals("1")) continue;
+ if (font.length > 12) {
+ if (!font[12].equals("iso8859") && !font[12].equals("")) continue;
+ if (font.length < 14 || !font[13].equals("1")) continue;
}
String name = font[1];
String size = font[6];
String slant = (font[3].equals("i") || font[3].equals("o")) ? "i" : "";
String bold = font[2].equals("bold") ? "b" : "";
- String tail = s.substring(1 + font[0].length() + 1 + font[1].length() + 1 + font[2].length() + 1 +
- font[3].length() + 1 + font[4].length() + 1);
+ String tail = s2.substring(1 + font[0].length() + 1 + font[1].length() + 1 + font[2].length() + 1 +
+ font[3].length() + 1 + font[4].length() + 1);
if (bold.equals("*") && slant.equals("*")) {
nativeFontList.put(name + size, font[0] + "-" + font[1] + "-regular-r-" + font[4] + "-" + tail);
nativeFontList.put(name + size + bold + "i", font[0] + "-" + font[1] + "-" + font[2] + "-i-" + font[4] + "-" + tail);
} else {
- nativeFontList.put(name + size + bold + slant, s);
+ nativeFontList.put(name + size + bold + slant, s2);
}
} catch (ArrayIndexOutOfBoundsException e) {
- if (Log.on) Log.log(this, "skipping incomplete font string " + s);
+ if (Log.on) Log.log(this, "skipping incomplete font string " + s2);
continue;
}
}
for(int j=0; j<6; j++) i = target.indexOf('-', i + 1);
target = target.substring(0, i + 1) + arg.size + target.substring(target.indexOf('-', i+1));
}
+ if (Log.on) Log.log(POSIX.class, "mapping font \"" + s + "\" to \"" + target + "\"");
RawData ret = fontStringToStruct(target);
if (ret == null) ret = fontStringToStruct("fixed");
xwtFontToFontStruct.put(s, new WrappedRawData(ret));