From ef8b3b1dd40a2ffc9e60f0f9eec1cf8289737e48 Mon Sep 17 00:00:00 2001 From: Icyllis Milica Date: Sun, 3 Nov 2024 19:38:29 +0800 Subject: [PATCH] Not force skipping OpenGL error checks Remove openURL in favor of openURI Print GLCaps as INFO level --- .../main/java/icyllis/modernui/core/Core.java | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/core/src/main/java/icyllis/modernui/core/Core.java b/core/src/main/java/icyllis/modernui/core/Core.java index 350e83c6..bf2dfc63 100644 --- a/core/src/main/java/icyllis/modernui/core/Core.java +++ b/core/src/main/java/icyllis/modernui/core/Core.java @@ -36,7 +36,6 @@ import java.io.*; import java.lang.ref.Cleaner; import java.net.URI; -import java.net.URL; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.channels.*; @@ -202,7 +201,6 @@ private static ContextOptions initContextOptions(@NonNull ContextOptions options if (options.mLogger == null || options.mLogger == NOPLogger.NOP_LOGGER) { options.mLogger = LoggerFactory.getLogger("Arc3D"); } - options.mSkipGLErrorChecks = Boolean.TRUE; return options; } @@ -249,7 +247,7 @@ public static boolean initOpenGL(@NonNull ContextOptions options) { LOGGER.info(MARKER, "OpenGL renderer: {}", glRenderer); LOGGER.info(MARKER, "OpenGL version: {}", glVersion); - LOGGER.debug(MARKER, "OpenGL caps: {}", dc.getCaps()); + LOGGER.info(MARKER, "OpenGL caps: {}", dc.getCaps()); return true; } @@ -702,17 +700,17 @@ public static ByteBuffer readIntoNativeBuffer(@NonNull InputStream stream) throw } /** - * Launches the associated application to open the URL. + * Launches the associated application to open the URI. * * @return true on success, false on failure */ - public static boolean openURL(@NonNull URL url) { + public static boolean openURI(@NonNull URI uri) { try { - String s = url.toString(); + String s = uri.toString(); String[] cmd = switch (Platform.get()) { case WINDOWS -> new String[]{"rundll32", "url.dll,FileProtocolHandler", s}; case MACOSX -> new String[]{"open", s}; - default -> new String[]{"xdg-open", url.getProtocol().equals("file") + default -> new String[]{"xdg-open", "file".equals(uri.getScheme()) ? s.replace("file:", "file://") : s}; }; @@ -721,20 +719,6 @@ public static boolean openURL(@NonNull URL url) { reader.lines().forEach(line -> LOGGER.error(MARKER, line)); } return true; - } catch (IOException e) { - LOGGER.error(MARKER, "Failed to open URL: {}", url, e); - return false; - } - } - - /** - * Launches the associated application to open the URL. - * - * @return true on success, false on failure - */ - public static boolean openURI(@NonNull URI uri) { - try { - return openURL(uri.toURL()); } catch (Exception e) { LOGGER.error(MARKER, "Failed to open URI: {}", uri, e); return false; @@ -742,7 +726,7 @@ public static boolean openURI(@NonNull URI uri) { } /** - * Launches the associated application to open the URL. + * Launches the associated application to open the URI. * * @return true on success, false on failure */