Skip to content
Commits on Source (6)
......@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.11.0-SNAPSHOT</version>
<version>4.12.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
......
......@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.11.0-SNAPSHOT</version>
<version>4.12.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
......
......@@ -26,6 +26,5 @@
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.dltk.sh.core.nature</nature>
</natures>
</projectDescription>
......@@ -11,8 +11,6 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Red Hat Inc. - stop generating pre 1.2 JNI code
* Martin Oberhuber (WindRiver) - [515610] Fix incorrect code for memmove()
* Thomas Wolf <thomas.wolf@paranor.ch> [534923] Fix incorrect casts
*******************************************************************************/
package org.eclipse.swt.tools.internal;
......@@ -264,31 +262,14 @@ void generateNativeMacro(JNIClass clazz) {
outputln();
}
boolean generateGetParameter(JNIMethod method, JNIParameter param, boolean critical, int indent) {
boolean generateGetParameter(JNIParameter param, boolean critical, int indent) {
JNIType paramType = param.getType(), paramType64 = param.getType64();
if (paramType.isPrimitive() || isSystemClass(paramType)) return false;
String iStr = String.valueOf(param.getParameter());
for (int j = 0; j < indent; j++) output("\t");
//if(!paramType.isArray() && !paramType.isType("java.lang.String") && param.getFlag(FLAG_NO_IN)) {
if("memmove".equals(method.getName()) && param.getFlag(FLAG_NO_IN)) {
// Bug 515610: Fix incorect fall-through for memmove().
// A similar issue might be present in other cases as well.
// Keep diagnostic code (commented-out) below for diagnosing these.
output("if (!arg");
output(iStr);
outputln(") goto fail;");
//output(") {fprintf(stderr,\"fail: method=");
//output(method.getName());
//output(", arg");
//output(iStr);
//output("\\n\"); goto fail;}\n");
for (int j = 0; j < indent; j++) output("\t");
output("if ((lparg");
} else {
output("if (arg");
output(iStr);
output(") if ((lparg");
}
output("if (arg");
output(iStr);
output(") if ((lparg");
output(iStr);
output(" = ");
boolean isCPP = getCPP();
......@@ -524,13 +505,13 @@ boolean generateLocalVars(JNIParameter[] params, JNIType returnType, JNIType ret
return needsReturn;
}
boolean generateGetters(JNIMethod method, JNIParameter[] params) {
boolean generateGetters(JNIParameter[] params) {
boolean genFailTag = false;
int criticalCount = 0;
for (int i = 0; i < params.length; i++) {
JNIParameter param = params[i];
if (!isCritical(param)) {
genFailTag |= generateGetParameter(method, param, false, 1);
genFailTag |= generateGetParameter(param, false, 1);
} else {
criticalCount++;
}
......@@ -539,7 +520,7 @@ boolean generateGetters(JNIMethod method, JNIParameter[] params) {
for (int i = 0; i < params.length; i++) {
JNIParameter param = params[i];
if (isCritical(param)) {
genFailTag |= generateGetParameter(method, param, true, 2);
genFailTag |= generateGetParameter(param, true, 2);
}
}
}
......@@ -794,14 +775,12 @@ void generateFunctionCall(JNIMethod method, JNIParameter[] params, JNIType retur
if (method.getFlag(Flags.FLAG_CAST)) {
output("((");
String returnCast = returnType.getTypeSignature2(!returnType.equals(returnType64));
if ((name.equals("objc_msgSend_bool") || name.equals("objc_msgSendSuper_bool")) && returnCast.equals("jboolean")) {
if (name.equals("objc_msgSend_bool") && returnCast.equals("jboolean")) {
returnCast = "BOOL";
}
output(returnCast);
output(" (*)(");
int fixedargs = getNumberOfFixedArguments(method);
int n = fixedargs > 0 ? fixedargs : params.length;
for (int i = 0; i < n; i++) {
for (int i = 0; i < params.length; i++) {
if (i != 0) output(", ");
JNIParameter param = params[i];
String cast = param.getCast();
......@@ -819,9 +798,6 @@ void generateFunctionCall(JNIMethod method, JNIParameter[] params, JNIType retur
output(paramType.getTypeSignature4(!paramType.equals(paramType64), param.getFlag(FLAG_STRUCT)));
}
}
if (fixedargs > 0) {
output(", ...");
}
output("))");
}
String accessor = method.getAccessor();
......@@ -881,8 +857,7 @@ void generate_objc_msgSend_stret (JNIParameter[] params, String func) {
JNIType paramType = params[0].getType(), paramType64 = params[0].getType64();
output(paramType.getTypeSignature4(!paramType.equals(paramType64), true));
output(" (*)(");
// Only the fixed arguments
for (int i = 1; i <= 2; i++) {
for (int i = 1; i < params.length; i++) {
if (i != 1) output(", ");
JNIParameter param = params[i];
String cast = param.getCast();
......@@ -900,33 +875,11 @@ void generate_objc_msgSend_stret (JNIParameter[] params, String func) {
output(paramType.getTypeSignature4(!paramType.equals(paramType64), param.getFlag(FLAG_STRUCT)));
}
}
output(", ...");
output("))");
output(func);
output(")");
}
/**
* Determines whether the {@code method} has variadic arguments. If so, returns
* the number of fixed parameters (always {@code > 0}). Otherwise returns zero,
* which indicates that all parameters are fixed.
*
* @param method to examine
* @return the number of fixed parameters, or zero if all parameters are fixed
* (the method has no varargs)
*/
int getNumberOfFixedArguments(JNIMethod method) {
Object param = method.getParam("fixedargs");
if (param == null) {
return 0;
}
String number = param.toString();
if (number.isEmpty()) {
return 0;
}
return Integer.parseInt(number);
}
void generateReturn(JNIType returnType, boolean needsReturn) {
if (needsReturn && !returnType.isType("void")) {
outputln("\treturn rc;");
......@@ -959,7 +912,7 @@ void generateFunctionBody(JNIMethod method, String function, String function64,
} else {
boolean needsReturn = generateLocalVars(params, returnType, returnType64);
generateEnterExitMacro(method, function, function64, true);
boolean genFailTag = generateGetters(method, params);
boolean genFailTag = generateGetters(params);
if (method.getFlag(FLAG_DYNAMIC)) {
generateDynamicFunctionCall(method, params, returnType, returnType64, needsReturn);
} else {
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.tools; singleton:=true
Bundle-Version: 3.107.300.qualifier
Bundle-Version: 3.107.400.qualifier
Bundle-Activator: org.eclipse.swt.tools.Activator
Bundle-ManifestVersion: 2
Export-Package: org.eclipse.swt.tools,
......
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.11.0-SNAPSHOT</version>
<version>4.12.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.tools</artifactId>
<version>3.107.300-SNAPSHOT</version>
<version>3.107.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
......@@ -35,6 +35,5 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
<nature>org.eclipse.dltk.sh.core.nature</nature>
</natures>
</projectDescription>
......@@ -464,12 +464,35 @@
</message_arguments>
</filter>
</resource>
<resource path="Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java" type="org.eclipse.swt.graphics.GCData">
<filter id="627060751">
<resource path="META-INF/MANIFEST.MF">
<filter comment="Planned deletion via Bug 475833 " id="926941240">
<message_arguments>
<message_argument value="3.111.0"/>
<message_argument value="3.110.0"/>
</message_arguments>
</filter>
</resource>
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.swt.custom.TableTree">
<filter comment="Planned deletion via Bug 475833 " id="305324134">
<message_arguments>
<message_argument value="org.eclipse.swt.custom.TableTree"/>
<message_argument value="org.eclipse.swt_3.111.0"/>
</message_arguments>
</filter>
</resource>
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.swt.custom.TableTreeEditor">
<filter comment="Planned deletion via Bug 475833 " id="305324134">
<message_arguments>
<message_argument value="org.eclipse.swt.custom.TableTreeEditor"/>
<message_argument value="org.eclipse.swt_3.111.0"/>
</message_arguments>
</filter>
</resource>
<resource path="META-INF/MANIFEST.MF" type="org.eclipse.swt.custom.TableTreeItem">
<filter comment="Planned deletion via Bug 475833 " id="305324134">
<message_arguments>
<message_argument value="PAINTSTRUCT"/>
<message_argument value="GCData"/>
<message_argument value="ps"/>
<message_argument value="org.eclipse.swt.custom.TableTreeItem"/>
<message_argument value="org.eclipse.swt_3.111.0"/>
</message_arguments>
</filter>
</resource>
......
......@@ -58,8 +58,8 @@ public class SWT_AWT {
static boolean loaded, swingInitialized;
static native final long /*int*/ getAWTHandle (Canvas canvas);
static native final Object initFrame (long /*int*/ handle, String className);
static native final long getAWTHandle (Canvas canvas);
static native final Object initFrame (long handle, String className);
static native final void validateWithBounds (Frame frame, int x, int y, int w, int h);
static native final void synthesizeWindowActivation (Frame frame, boolean doActivate);
......@@ -137,7 +137,7 @@ public static Frame new_Frame(final Composite parent) {
if ((parent.getStyle() & SWT.EMBEDDED) == 0) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
final long /*int*/ handle = parent.view.id;
final long handle = parent.view.id;
final String className = embeddedFrameClass != null ? embeddedFrameClass : JDK17_FRAME;
try {
if (embeddedFrameClass != null) {
......@@ -178,7 +178,7 @@ public static Frame new_Frame(final Composite parent) {
EventQueue.invokeLater(runnable);
Display display = parent.getDisplay();
while (result[0] == null && exception[0] == null) {
display.setData(RUN_AWT_INVOKE_LATER_KEY, new Boolean (true));
display.setData(RUN_AWT_INVOKE_LATER_KEY, true);
Boolean invoked = (Boolean)display.getData(RUN_AWT_INVOKE_LATER_KEY);
if (invoked != null && !invoked.booleanValue()) {
runnable.run();
......@@ -311,7 +311,7 @@ public static Frame new_Frame(final Composite parent) {
public static Shell new_Shell(final Display display, final Canvas parent) {
if (display == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
long /*int*/ handle = 0;
long handle = 0;
try {
loadLibrary ();
......
......@@ -55,9 +55,9 @@ public class SWT_AWT {
static boolean loaded, swingInitialized;
static native final long /*int*/ getAWTHandle (Object canvas);
static native final long getAWTHandle (Object canvas);
static native final void setDebug (Frame canvas, boolean debug);
static native final Object initFrame (long /*int*/ handle, String className);
static native final Object initFrame (long handle, String className);
static native final void validateWithBounds (Frame frame, int x, int y, int w, int h);
static native final void synthesizeWindowActivation (Frame frame, boolean doActivate);
static native final void registerListeners (Frame frame);
......@@ -148,7 +148,7 @@ public static Frame new_Frame (final Composite parent) {
if ((parent.getStyle () & SWT.EMBEDDED) == 0) {
SWT.error (SWT.ERROR_INVALID_ARGUMENT);
}
long /*int*/ handle = parent.embeddedHandle;
long handle = parent.embeddedHandle;
/*
* Some JREs have implemented the embedded frame constructor to take an integer
* and other JREs take a long. To handle this binary incompatibility, use
......@@ -186,9 +186,9 @@ public static Frame new_Frame (final Composite parent) {
parent.getDisplay().asyncExec(() -> {
if (parent.isDisposed()) return;
Shell shell = parent.getShell();
long /*int*/ awtHandle = getAWTHandle(window);
long awtHandle = getAWTHandle(window);
if (awtHandle == 0) return;
long /*int*/ xWindow = GDK.gdk_x11_window_get_xid (GTK.gtk_widget_get_window (GTK.gtk_widget_get_toplevel (shell.handle)));
long xWindow = GDK.gdk_x11_window_get_xid (GTK.gtk_widget_get_window (GTK.gtk_widget_get_toplevel (shell.handle)));
OS.XSetTransientForHint(GDK.gdk_x11_display_get_xdisplay(GDK.gdk_display_get_default()), awtHandle, xWindow);
});
}
......@@ -262,7 +262,7 @@ public static Shell new_Shell (final Display display, final Canvas parent) {
if (OS.IsWin32) SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
if (display == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
long /*int*/ handle = 0;
long handle = 0;
try {
loadLibrary ();
handle = getAWTHandle (parent);
......
......@@ -150,7 +150,7 @@ public class Accessible {
if (accessible.delegate != null) return accessible.delegate;
if (accessible.control != null) {
NSView view = accessible.control.view;
long /*int*/ handle = OS.objc_msgSend(view.id, OS.sel_accessibleHandle);
long handle = OS.objc_msgSend(view.id, OS.sel_accessibleHandle);
return new id(handle);
}
return null;
......@@ -444,9 +444,9 @@ public class Accessible {
accessibleAttributeListeners.add(listener);
}
void addCGColor(double /*float*/ [] comps, NSMutableAttributedString inAttribString, NSString inAttribute, NSRange inRange) {
long /*int*/ cgColorSpace = OS.CGColorSpaceCreateDeviceRGB();
long /*int*/ cgColor = OS.CGColorCreate(cgColorSpace, comps);
void addCGColor(double [] comps, NSMutableAttributedString inAttribString, NSString inAttribute, NSRange inRange) {
long cgColorSpace = OS.CGColorSpaceCreateDeviceRGB();
long cgColor = OS.CGColorCreate(cgColorSpace, comps);
OS.CGColorSpaceRelease(cgColorSpace);
inAttribString.addAttribute(inAttribute, new id(cgColor), inRange);
OS.CGColorRelease(cgColor);
......@@ -1268,8 +1268,8 @@ public class Accessible {
if (attribute.isEqualToString(OS.NSAccessibilityHeaderAttribute)) return getHeaderAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityIndexAttribute)) return getIndexAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilitySelectedAttribute)) return getSelectedAttribute(childID);
if (OS.VERSION >= 0x1060 && attribute.isEqualToString(OS.NSAccessibilityRowIndexRangeAttribute)) return getRowIndexRangeAttribute(childID);
if (OS.VERSION >= 0x1060 && attribute.isEqualToString(OS.NSAccessibilityColumnIndexRangeAttribute)) return getColumnIndexRangeAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityRowIndexRangeAttribute)) return getRowIndexRangeAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityColumnIndexRangeAttribute)) return getColumnIndexRangeAttribute(childID);
// If this object don't know how to get the value it's up to the control itself to return an attribute value.
return null;
......@@ -1296,7 +1296,7 @@ public class Accessible {
if (attribute.isEqualToString(OS.NSAccessibilityRangeForPositionParameterizedAttribute)) return getRangeForPositionParameterizedAttribute(parameter, childID);
if (attribute.isEqualToString(OS.NSAccessibilityAttributedStringForRangeParameterizedAttribute)) return getAttributedStringForRangeParameterizedAttribute(parameter, childID);
if (attribute.isEqualToString(OS.NSAccessibilityStyleRangeForIndexParameterizedAttribute)) return getStyleRangeForIndexAttribute(parameter, childID);
if (OS.VERSION >= 0x1060 && attribute.isEqualToString(OS.NSAccessibilityCellForColumnAndRowParameterizedAttribute)) return getCellForColumnAndRowParameter(parameter, childID);
if (attribute.isEqualToString(OS.NSAccessibilityCellForColumnAndRowParameterizedAttribute)) return getCellForColumnAndRowParameter(parameter, childID);
return null;
}
......@@ -1460,7 +1460,7 @@ public class Accessible {
returnValue.addObject(OS.NSAccessibilityStyleRangeForIndexParameterizedAttribute);
break;
case ACC.ROLE_TABLE:
if (OS.VERSION >= 0x1060) returnValue.addObject(OS.NSAccessibilityCellForColumnAndRowParameterizedAttribute);
returnValue.addObject(OS.NSAccessibilityCellForColumnAndRowParameterizedAttribute);
break;
}
......@@ -1608,7 +1608,7 @@ public class Accessible {
AccessibleTextAttributeEvent event = new AccessibleTextAttributeEvent(this);
event.offset = (int) /*64*/ range.location;
event.offset = (int) range.location;
event.start = event.end = -1;
NSRange attributeRange = new NSRange();
......@@ -1653,7 +1653,7 @@ public class Accessible {
fontInfoDict.setValue(familyName, OS.NSAccessibilityFontFamilyKey);
NSString displayName = fontUsed.displayName();
fontInfoDict.setValue(displayName, OS.NSAccessibilityVisibleNameKey);
double /*float*/ fontSize = fontUsed.pointSize();
double fontSize = fontUsed.pointSize();
fontInfoDict.setValue(NSNumber.numberWithDouble(fontSize), OS.NSAccessibilityFontSizeKey);
attribString.addAttribute(OS.NSAccessibilityFontTextAttribute, fontInfoDict, attributeRange);
......@@ -1753,8 +1753,8 @@ public class Accessible {
if (accessibleTextExtendedListenersSize() > 0) {
AccessibleTextEvent event = new AccessibleTextEvent(this);
event.childID = childID;
event.start = (int)/*64*/range.location;
event.end = (int)/*64*/(range.location + range.length);
event.start = (int)range.location;
event.end = (int)(range.location + range.length);
for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
listener.getTextBounds(event);
......@@ -2604,8 +2604,8 @@ public class Accessible {
if (accessibleTextExtendedListenersSize() > 0) {
AccessibleTextEvent event = new AccessibleTextEvent(this);
event.childID = childID;
event.start = (int) /*64*/ range.location;
event.end = (int) /*64*/ (range.location + range.length);
event.start = (int) range.location;
event.end = (int) (range.location + range.length);
event.type = ACC.TEXT_BOUNDARY_ALL;
for (int i = 0; i < accessibleTextExtendedListenersSize(); i++) {
AccessibleTextExtendedListener listener = accessibleTextExtendedListeners.get(i);
......@@ -2623,7 +2623,7 @@ public class Accessible {
String appValue = event.result;
if (appValue != null) {
returnValue = NSString.stringWith(appValue.substring((int)/*64*/range.location, (int)/*64*/(range.location + range.length)));
returnValue = NSString.stringWith(appValue.substring((int)range.location, (int)(range.location + range.length)));
}
}
return returnValue;
......@@ -2683,7 +2683,7 @@ public class Accessible {
int index = parameterObject.intValue();
AccessibleTextAttributeEvent event = new AccessibleTextAttributeEvent(this);
event.offset = (int) /*64*/ index;
event.offset = (int) index;
// Marker values -- if -1 after calling getTextAttributes, no one implemented it.
event.start = event.end = -1;
......@@ -3345,8 +3345,8 @@ public class Accessible {
if (rangeObj != null) {
NSRange range = new NSValue(rangeObj).rangeValue();
rangeStart = (int)/*64*/range.location;
rangeEnd = (int)/*64*/(range.location + range.length);
rangeStart = (int)range.location;
rangeEnd = (int)(range.location + range.length);
}
if (accessibleEditableTextListenersSize() > 0) {
......@@ -3578,7 +3578,7 @@ public class Accessible {
*
* @noreference This method is not intended to be referenced by clients.
*/
public long /*int*/ internal_addRelationAttributes(long /*int*/ defaultAttributes) {
public long internal_addRelationAttributes(long defaultAttributes) {
NSArray attributes = new NSArray(defaultAttributes);
NSMutableArray returnArray = NSMutableArray.arrayWithCapacity(attributes.count());
returnArray.addObjectsFromArray(attributes);
......
......@@ -31,10 +31,10 @@ class SWTAccessibleDelegate extends NSObject {
static final byte[] SWT_OBJECT = {'S', 'W', 'T', '_', 'O', 'B', 'J', 'E', 'C', 'T', '\0'};
static Callback accessible2Args, accessible3Args, accessible4Args;
static long /*int*/ proc2Args, proc3Args, proc4Args;
static long proc2Args, proc3Args, proc4Args;
Accessible accessible;
long /*int*/ delegateJniRef;
long delegateJniRef;
int childID;
NSArray attributeNames = null;
......@@ -67,7 +67,7 @@ class SWTAccessibleDelegate extends NSObject {
byte[] types = {'*','\0'};
int size = C.PTR_SIZEOF, align = C.PTR_SIZEOF == 4 ? 2 : 3;
long /*int*/ cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
long cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
// Add the NSAccessibility overrides
......@@ -176,7 +176,7 @@ class SWTAccessibleDelegate extends NSObject {
return new NSArray(temp2.id);
}
static long /*int*/ accessibleProc(long /*int*/ id, long /*int*/ sel) {
static long accessibleProc(long id, long sel) {
SWTAccessibleDelegate swtAcc = getAccessibleDelegate(id);
if (swtAcc == null) return 0;
......@@ -200,7 +200,7 @@ class SWTAccessibleDelegate extends NSObject {
return 0;
}
static long /*int*/ accessibleProc(long /*int*/ id, long /*int*/ sel, long /*int*/ arg0) {
static long accessibleProc(long id, long sel, long arg0) {
SWTAccessibleDelegate swtAcc = getAccessibleDelegate(id);
if (swtAcc == null) return 0;
......@@ -228,7 +228,7 @@ class SWTAccessibleDelegate extends NSObject {
return 0;
}
static long /*int*/ accessibleProc(long /*int*/ id, long /*int*/ sel, long /*int*/ arg0, long /*int*/ arg1) {
static long accessibleProc(long id, long sel, long arg0, long arg1) {
SWTAccessibleDelegate swtAcc = getAccessibleDelegate(id);
if (swtAcc == null) return 0;
......@@ -246,9 +246,9 @@ class SWTAccessibleDelegate extends NSObject {
return 0;
}
static SWTAccessibleDelegate getAccessibleDelegate(long /*int*/ id) {
static SWTAccessibleDelegate getAccessibleDelegate(long id) {
if (id == 0) return null;
long /*int*/ [] jniRef = new long /*int*/ [1];
long [] jniRef = new long [1];
OS.object_getInstanceVariable(id, SWT_OBJECT, jniRef);
if (jniRef[0] == 0) return null;
return (SWTAccessibleDelegate)OS.JNIGetObject(jniRef[0]);
......
......@@ -117,7 +117,7 @@ public class Accessible {
Accessible (Control control) {
super ();
this.control = control;
long /*int*/ type = OS.G_OBJECT_TYPE (getControlHandle());
long type = OS.G_OBJECT_TYPE (getControlHandle());
accessibleObject = new AccessibleObject (type, getControlHandle(), this, false);
addRelations();
}
......@@ -479,8 +479,8 @@ public class Accessible {
AccessibleObject getAccessibleObject () {
if (accessibleObject == null) {
long /*int*/ widget = this.getControlHandle();
long /*int*/ type = OS.G_OBJECT_TYPE (widget);
long widget = this.getControlHandle();
long type = OS.G_OBJECT_TYPE (widget);
if (parent == null) {
accessibleObject = new AccessibleObject (type, widget, this, false);
} else {
......@@ -491,14 +491,14 @@ public class Accessible {
return accessibleObject;
}
long /*int*/ getControlHandle () {
long /*int*/ result = control.handle;
long getControlHandle () {
long result = control.handle;
if (control instanceof Label) {
long /*int*/ list = GTK.gtk_container_get_children (result);
long list = GTK.gtk_container_get_children (result);
if (list != 0) {
long /*int*/ temp = list;
long temp = list;
while (temp != 0) {
long /*int*/ widget = OS.g_list_data( temp);
long widget = OS.g_list_data( temp);
if (GTK.gtk_widget_get_visible (widget)) {
result = widget;
break;
......
......@@ -104,17 +104,18 @@ public Browser (Composite parent, int style) {
}
dispose ();
String errMsg = " because no underlying browser available.\n";
String errMsg = " because there is no underlying browser available.\n";
switch (SWT.getPlatform()) {
case "gtk":
errMsg = errMsg + " Please ensure Webkit with its Gtk 3.x bindings installed. Webkit2 API level preferred.\n";
errMsg = errMsg + "Please ensure that WebKit with its GTK 3.x bindings is installed (WebKit2 API level is preferred)."
+ " Additionally, please note that GTK4 does not currently have Browser support.\n";
break;
case "cocoa":
errMsg = errMsg + " SWT failed to load webkit library.\n";
errMsg = errMsg + "SWT failed to load the WebKit library.\n";
break;
case "win32":
errMsg = errMsg + " SWT uses either IE or Webkit. Either SWT.WEBKIT flag is passed and Webkit library was not "
+ "loaded properly by SWT or SWT failed to load IE.\n";
errMsg = errMsg + "SWT uses either IE or WebKit. Either the SWT.WEBKIT flag is passed and the WebKit library was not "
+ "loaded properly by SWT, or SWT failed to load IE.\n";
break;
default:
break;
......
......@@ -19,6 +19,7 @@ class BrowserFactory {
WebBrowser createWebBrowser (int style) {
if (OS.IsWin32) return null;
if (GTK.GTK4) return null;
boolean webkitInstalled = WebKit.IsInstalled ();
if (!webkitInstalled) return null;
......
......@@ -478,7 +478,7 @@ public void create(Composite parent, int style) {
long /*int*/ pCancel1 = cancel1.getByRef();
OS.MoveMemory(pCancel1, new short[] {OS.VARIANT_FALSE}, 2);
}
isAboutBlank = false;
setAboutBlank(false);
break;
} else {
/*
......@@ -536,7 +536,7 @@ public void create(Composite parent, int style) {
Variant variant1 = new Variant(auto); /* does not need to be disposed */
IDispatch top1 = variant1.getDispatch();
if (top1.getAddress() == dispatch1.getAddress()) {
isAboutBlank = url1.startsWith(ABOUT_BLANK);
setAboutBlank(url1.startsWith(ABOUT_BLANK));
}
}
break;
......@@ -701,7 +701,7 @@ public void create(Composite parent, int style) {
Variant variant3 = new Variant(auto); /* does not need to be disposed */
IDispatch top3 = variant3.getDispatch();
if (top3.getAddress() == dispatch3.getAddress()) {
isAboutBlank = url3.startsWith(ABOUT_BLANK);
setAboutBlank(url3.startsWith(ABOUT_BLANK));
lastNavigateURL = url3;
}
}
......@@ -1431,6 +1431,20 @@ void setHTML (String string) {
}
}
private void setAboutBlank(boolean value) {
isAboutBlank = value;
updateForceTrusted();
}
private void setUntrustedText(boolean value) {
untrustedText = value;
updateForceTrusted();
}
private void updateForceTrusted() {
site.isForceTrusted = isAboutBlank && !untrustedText;
}
@Override
public boolean setText(final String html, boolean trusted) {
/*
......@@ -1440,7 +1454,7 @@ public boolean setText(final String html, boolean trusted) {
* to ensure that all expected client events are sent.
*/
if (performingInitialNavigate) {
pendingText = new Object[] {html, new Boolean (trusted)};
pendingText = new Object[] {html, trusted};
pendingUrl = null;
return true;
}
......@@ -1452,7 +1466,7 @@ public boolean setText(final String html, boolean trusted) {
*/
boolean blankLoading = this.html != null;
this.html = html;
untrustedText = !trusted;
setUntrustedText(!trusted);
if (blankLoading) return true;
/*
......@@ -1567,7 +1581,7 @@ public void stop() {
* Ensure that isAboutBlank is set accurately since Stop can be issued at
* any stage in the page load cycle.
*/
isAboutBlank = getUrl().startsWith(ABOUT_BLANK);
setAboutBlank(getUrl().startsWith(ABOUT_BLANK));
uncRedirect = null;
int[] rgdispid = auto.getIDsOfNames(new String[] { "Stop" }); //$NON-NLS-1$
......
......@@ -31,6 +31,7 @@ class WebSite extends OleControlSite {
COMObject iAuthenticate;
COMObject iDispatch;
boolean ignoreNextMessage, ignoreAllMessages;
boolean isForceTrusted;
Boolean canExecuteApplets;
static final int OLECMDID_SHOWSCRIPTERROR = 40;
......@@ -559,12 +560,7 @@ int MapUrlToZone(long /*int*/ pwszUrl, long /*int*/ pdwZone, int dwFlags) {
* to follow local links. The workaround is to return URLZONE_INTRANET
* instead of the default value URLZONE_LOCAL_MACHINE.
*/
IE ie = (IE)((Browser)getParent().getParent()).webBrowser;
/*
* For some reason IE8 invokes this function after the Browser has
* been disposed. To detect this case check for ie.auto != null.
*/
if (ie.auto != null && ie.isAboutBlank && !ie.untrustedText) {
if (isForceTrusted) {
OS.MoveMemory(pdwZone, new int[] {IE.URLZONE_INTRANET}, 4);
return COM.S_OK;
}
......@@ -861,13 +857,13 @@ Object convertToJava (Variant variant) {
case OLE.VT_EMPTY:
case OLE.VT_NULL: return null;
case OLE.VT_BSTR: return variant.getString ();
case OLE.VT_BOOL: return new Boolean (variant.getBoolean ());
case OLE.VT_BOOL: return variant.getBoolean ();
case OLE.VT_I2:
case OLE.VT_I4:
case OLE.VT_I8:
case OLE.VT_R4:
case OLE.VT_R8:
return new Double (variant.getDouble ());
return variant.getDouble ();
case OLE.VT_DISPATCH: {
Object[] args = null;
OleAutomation auto = variant.getAutomation ();
......