mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
[UI] FullScreen mode for Mac OS clients
This commit is contained in:
parent
bf711705a7
commit
41a2046479
2 changed files with 43 additions and 0 deletions
|
|
@ -56,6 +56,7 @@ import mage.client.table.TablesPane;
|
|||
import mage.client.tournament.TournamentPane;
|
||||
import mage.client.util.EDTExceptionHandler;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.SystemUtil;
|
||||
import mage.client.util.audio.MusicPlayer;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.client.util.stats.UpdateMemUsageTask;
|
||||
|
|
@ -313,6 +314,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (SystemUtil.isMacOSX()) {
|
||||
SystemUtil.enableMacOSFullScreenMode(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void addTooltipContainer() {
|
||||
|
|
|
|||
38
Mage.Client/src/main/java/mage/client/util/SystemUtil.java
Normal file
38
Mage.Client/src/main/java/mage/client/util/SystemUtil.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package mage.client.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
public class SystemUtil {
|
||||
|
||||
public static final String OS_NAME = "os.name";
|
||||
public static final String MAC_OS_X = "Mac OS X";
|
||||
|
||||
private SystemUtil() {
|
||||
}
|
||||
|
||||
public static boolean isMacOSX() {
|
||||
return System.getProperty(OS_NAME).contains(MAC_OS_X);
|
||||
}
|
||||
|
||||
public static void enableMacOSFullScreenMode(Window window) {
|
||||
String className = "com.apple.eawt.FullScreenUtilities";
|
||||
String methodName = "setWindowCanFullScreen";
|
||||
|
||||
try {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String... args) {
|
||||
System.out.println(isMacOSX());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue