Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retire the gdx-lwjgl3-glfw-awt-macos extension #7361

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import org.lwjgl.system.Configuration;

public class Lwjgl3Application implements Lwjgl3ApplicationBase {
private final Lwjgl3ApplicationConfiguration config;
Expand All @@ -80,7 +79,6 @@ public class Lwjgl3Application implements Lwjgl3ApplicationBase {

static void initializeGlfw () {
if (errorCallback == null) {
if (SharedLibraryLoader.isMac) loadGlfwAwtMacos();
Lwjgl3NativesLoader.load();
errorCallback = GLFWErrorCallback.createPrint(Lwjgl3ApplicationConfiguration.errorStream);
GLFW.glfwSetErrorCallback(errorCallback);
Expand Down Expand Up @@ -116,20 +114,6 @@ static void postLoadANGLE () {
}
}

static void loadGlfwAwtMacos () {
try {
Class loader = Class.forName("com.badlogic.gdx.backends.lwjgl3.awt.GlfwAWTLoader");
Method load = loader.getMethod("load");
File sharedLib = (File)load.invoke(loader);
Configuration.GLFW_LIBRARY_NAME.set(sharedLib.getAbsolutePath());
Configuration.GLFW_CHECK_THREAD0.set(false);
} catch (ClassNotFoundException t) {
return;
} catch (Throwable t) {
throw new GdxRuntimeException("Couldn't load GLFW AWT for macOS.", t);
}
}

public Lwjgl3Application (ApplicationListener listener) {
this(listener, new Lwjgl3ApplicationConfiguration());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class Lwjgl3Graphics extends AbstractGraphics implements Disposable {

@Override
public void invoke (long windowHandle, final int width, final int height) {
if (Configuration.GLFW_CHECK_THREAD0.get(true)) {
if (!Configuration.GLFW_LIBRARY_NAME.get().equals("glfw_async")) {
renderWindow(windowHandle, width, height);
} else {
if (posted) return;
Expand Down
20 changes: 1 addition & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ tasks.register('setupExternalNativesDirs') {
doLast {
file("build").mkdir();
file("extensions/gdx-lwjgl3-angle/res").mkdirs();
file("extensions/gdx-lwjgl3-glfw-awt-macos/res/macosx64").mkdirs();
file("extensions/gdx-lwjgl3-glfw-awt-macos/res/macosarm64").mkdirs();
}
doNotTrackState("Don't track state")
}
Expand All @@ -194,24 +192,8 @@ tasks.register('fetchAngleNativesZIP', Download) {
useETag "all"
}

tasks.register('fetchGlfwAWT', Download) {
dependsOn setupExternalNativesDirs
src 'https://raw.githubusercontent.com/badlogic/glfw/master/libglfw.dylib'
dest 'extensions/gdx-lwjgl3-glfw-awt-macos/res/macosx64/libglfw.dylib'
onlyIfModified true
useETag "all"
}

tasks.register('fetchGlfwAWTARM64', Download) {
dependsOn setupExternalNativesDirs
src 'https://raw.githubusercontent.com/badlogic/glfw/master/libglfwarm64.dylib'
dest 'extensions/gdx-lwjgl3-glfw-awt-macos/res/macosarm64/libglfwarm64.dylib'
onlyIfModified true
useETag "all"
}

tasks.register('fetchExternalNatives', Copy) {
dependsOn fetchAngleNativesZIP, fetchGlfwAWT, fetchGlfwAWTARM64
dependsOn fetchAngleNativesZIP
from zipTree("build/gdx-angle-natives.zip")
into "./extensions/gdx-lwjgl3-angle/res"
doNotTrackState("Don't track state")
Expand Down
24 changes: 0 additions & 24 deletions extensions/gdx-lwjgl3-glfw-awt-macos/build.gradle

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ configure([
project(":extensions:gdx-bullet"),
project(":extensions:gdx-freetype"),
project(":extensions:gdx-lwjgl3-angle"),
project(":extensions:gdx-lwjgl3-glfw-awt-macos"),
project(":extensions:gdx-tools")
]) {
apply plugin: 'maven-publish'
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ include ":extensions:gdx-freetype"
include ":extensions:gdx-setup"
include ":extensions:gdx-tools"
include ":extensions:gdx-lwjgl3-angle"
include ":extensions:gdx-lwjgl3-glfw-awt-macos"

include ":tests"
include ":tests:gdx-tests"
Expand Down
1 change: 0 additions & 1 deletion tests/gdx-tests-lwjgl3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ dependencies {
implementation project(":tests:gdx-tests")
implementation project(":backends:gdx-backend-lwjgl3")
implementation project(":extensions:gdx-lwjgl3-angle")
implementation project(":extensions:gdx-lwjgl3-glfw-awt-macos")
implementation testnatives.desktop
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import javax.imageio.ImageIO;
import javax.swing.*;

import com.badlogic.gdx.backends.lwjgl3.awt.GlfwAWTLoader;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import org.lwjgl.glfw.GLFWMouseButtonCallback;
import org.lwjgl.opengl.GL;
Expand Down Expand Up @@ -52,9 +51,14 @@ public void run () {
};

public static void main (String[] args) throws Exception {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run () {
java.awt.Toolkit.getDefaultToolkit();
}
});

if (SharedLibraryLoader.isMac) {
Configuration.GLFW_CHECK_THREAD0.set(false);
Configuration.GLFW_LIBRARY_NAME.set(GlfwAWTLoader.load().getAbsolutePath());
Configuration.GLFW_LIBRARY_NAME.set("glfw_async");
}

if (!glfwInit()) {
Expand Down