Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.1
0.3.2
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ private JavascriptValue onCallAsFunction(
);

try {
Object ret = method.invoke(privateData.instance(), parameters.toArray());
Class<?> suggestedReturnType = method.getReturnType();

if (ret != null) {
suggestedReturnType = ret.getClass();
}

// Invoke method with constructed arguments
return conversionUtils.toJavascript(
context, method.invoke(privateData.instance(), parameters.toArray()), method.getReturnType());
return conversionUtils.toJavascript(context, ret, suggestedReturnType);
} catch (IllegalAccessException exception) {
throw new JavascriptInteropException("Unable to access method: " + method.getName(), exception);
} catch (InvocationTargetException exception) {
Expand Down
2 changes: 1 addition & 1 deletion ultralight-java-lwjgl3-opengl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def ultralightOsIdentifier = {

task copyTestResources(type: Copy) {
from new File(project(':ultralight-java-native').buildDir, "cmake-gen-${ultralightOsIdentifier()}/3rdparty/ultralight-${ultralightOsIdentifier()}/bin")
include "**/*.dll", "resources/*"
include "**/*.dll", "**/*.so", "**/*.dylib", "resources/*"
into runDir
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,40 @@ public void run() {
// Update the size
updateSize(window, sizeBuffer.get(0), sizeBuffer.get(1));

/*
* Following snippet disabled due to GLFW bug, glfwGetWindowContentScale returns invalid values!
*
* On a test system
*/
// Update scale for the first time
FloatBuffer scaleBuffer = stack.callocFloat(2);
// FloatBuffer scaleBuffer = stack.callocFloat(2);

// Retrieve the size into the float buffer
glfwGetWindowContentScale(window,
(FloatBuffer) scaleBuffer.slice().position(0), (FloatBuffer) scaleBuffer.slice().position(1));
// Retrieve the scale into the float buffer
// glfwGetWindowContentScale(window,
// (FloatBuffer) scaleBuffer.slice().position(0), (FloatBuffer) scaleBuffer.slice().position(1));

// Retrieve framebuffer size for scale calculation
IntBuffer framebufferSizeBuffer = stack.callocInt(2);

// Retrieve the size into the int buffer
glfwGetFramebufferSize(window,
(IntBuffer) framebufferSizeBuffer.slice().position(0), (IntBuffer) sizeBuffer.slice().position(1));

// Calculate scale
float xScale = ((float) (framebufferSizeBuffer.get(0))) / ((float) (sizeBuffer.get(0)));
float yScale = ((float) (framebufferSizeBuffer.get(1))) / ((float) (sizeBuffer.get(1)));

// Fix up scale in case it gets corrupted... somehow
if(xScale == 0.0f) {
xScale = 1.0f;
}

if(yScale == 0.0f) {
yScale = 1.0f;
}

// Update the scale
inputAdapter.windowContentScaleCallback(window, scaleBuffer.get(0), scaleBuffer.get(1));
inputAdapter.windowContentScaleCallback(window, xScale, yScale);
}

glEnable(GL_MULTISAMPLE);
Expand Down