mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
debug: added command line param to disable full screen mode on mac os (-Dxmage.fullScreen=false - useless);
This commit is contained in:
parent
55e8cac66a
commit
f78177a540
2 changed files with 21 additions and 19 deletions
|
|
@ -88,7 +88,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static final Logger LOGGER = Logger.getLogger(MageFrame.class);
|
||||
private static final String LITE_MODE_ARG = "-lite";
|
||||
private static final String GRAY_MODE_ARG = "-gray";
|
||||
private static final String FILL_SCREEN_ARG = "-fullscreen";
|
||||
private static final String FULL_SCREEN_PROP = "xmage.fullScreen"; // -Dxmage.fullScreen=false
|
||||
private static final String SKIP_DONE_SYMBOLS = "-skipDoneSymbols";
|
||||
private static final String USER_ARG = "-user";
|
||||
private static final String PASSWORD_ARG = "-pw";
|
||||
|
|
@ -113,7 +113,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static boolean liteMode = false;
|
||||
//TODO: make gray theme, implement theme selector in preferences dialog
|
||||
private static boolean grayMode = false;
|
||||
private static boolean fullscreenMode = false;
|
||||
private static boolean macOsFullScreenEnabled = true;
|
||||
private static boolean skipSmallSymbolGenerationForExisting = false;
|
||||
private static String startUser = null;
|
||||
private static String startPassword = "";
|
||||
|
|
@ -203,6 +203,12 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
setWindowTitle();
|
||||
|
||||
// mac os only: enable full screen support in java 8 (java 11+ try to use it all the time)
|
||||
if (MacFullscreenUtil.isMacOSX() && macOsFullScreenEnabled) {
|
||||
MacFullscreenUtil.enableMacOSFullScreenMode(this);
|
||||
MacFullscreenUtil.toggleMacOSFullScreenMode(this);
|
||||
}
|
||||
|
||||
EDTExceptionHandler.registerExceptionHandler();
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
|
|
@ -387,13 +393,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
setWindowTitle();
|
||||
});
|
||||
|
||||
if (MacFullscreenUtil.isMacOSX()) {
|
||||
MacFullscreenUtil.enableMacOSFullScreenMode(this);
|
||||
if (fullscreenMode) {
|
||||
MacFullscreenUtil.toggleMacOSFullScreenMode(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bootstrapSetsAndFormats() {
|
||||
|
|
@ -1423,8 +1422,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (arg.startsWith(GRAY_MODE_ARG)) {
|
||||
grayMode = true;
|
||||
}
|
||||
if (arg.startsWith(FILL_SCREEN_ARG)) {
|
||||
fullscreenMode = true;
|
||||
if (System.getProperty(FULL_SCREEN_PROP) != null) {
|
||||
macOsFullScreenEnabled = Boolean.parseBoolean(System.getProperty(FULL_SCREEN_PROP));
|
||||
}
|
||||
if (arg.startsWith(SKIP_DONE_SYMBOLS)) {
|
||||
skipSmallSymbolGenerationForExisting = true;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,22 @@
|
|||
package mage.client.util;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
* @author noxx, JayDi85
|
||||
*/
|
||||
public final class MacFullscreenUtil {
|
||||
|
||||
public static final String OS_NAME = "os.name";
|
||||
public static final String MAC_OS_X = "Mac OS X";
|
||||
|
||||
private MacFullscreenUtil() {}
|
||||
private static final Logger logger = Logger.getLogger(MacFullscreenUtil.class);
|
||||
|
||||
private MacFullscreenUtil() {
|
||||
}
|
||||
|
||||
public static boolean isMacOSX() {
|
||||
return System.getProperty(OS_NAME).contains(MAC_OS_X);
|
||||
|
|
@ -26,9 +31,8 @@ public final class MacFullscreenUtil {
|
|||
Class<?> clazz = Class.forName(className);
|
||||
Method method = clazz.getMethod(methodName, Window.class, boolean.class);
|
||||
method.invoke(null, window, true);
|
||||
} catch (Throwable t) {
|
||||
System.err.println("Full screen mode is not supported");
|
||||
t.printStackTrace();
|
||||
} catch (Throwable e) {
|
||||
logger.error("Can't enable full screen support in Mac OS - " + e, e);
|
||||
}
|
||||
} else {
|
||||
// Nothing needed. Running with Java 11+ (even when compiled for 1.8) automatically allows for full screen toggling.
|
||||
|
|
@ -49,9 +53,8 @@ public final class MacFullscreenUtil {
|
|||
Class[] params = new Class[]{Window.class};
|
||||
method = clazz.getMethod(methodName2, params);
|
||||
method.invoke(appInstance, window);
|
||||
} catch (Throwable t) {
|
||||
System.err.println("Full screen mode is not supported");
|
||||
t.printStackTrace();
|
||||
} catch (Throwable e) {
|
||||
logger.error("Can't toggle full screen in Mac OS - " + e, e);
|
||||
}
|
||||
} else {
|
||||
// TODO: Need a solution for automatically entering fullscreen under Java 11+
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue