Open mattiasb opened 9 years ago
+1, this problem occurs on my Yoga 2 Pro running Windows 8 as well. It'd be awesome to be able to play on that thing instead of just my Windows desktop (since it's currently unplayable on my Linux desktop as well).
That blows. Can't find anything about upcoming support for swing and scaling either. For those who are in my particular situation, setting the resolution to half the maximum and the scaling to 100% makes Xmage usable.
Looks like Linux behaviour with Swing is just really awful. I'm on ElementaryOS and the client window originally opens cut off on the right side. I have to scoot it up and over to the left, then resize to achieve the desired size.
This is supposed to be supported in JDK9 according to JEP-263.
I tested switching out the Nimbus look-and-feel for the GTK+ one and can confirm that the scaling looks semi-reasonable but there were a bunch of bugs (the game panel wouldn't work for example).
Display scaling can be enabled for Windows 10 as follows:
Install xmage in the usual way. I'm using a "C:\temp\xmage" directory in this example.
Create a "javaw.exe.manifest" file and place it next to javaw.exe in the bundled JRE install (for example, at "C:\temp\xmage\java\jre1.8.0_131\bin") with the following contents:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<description>javaw</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3"
level="asInvoker"
ms_asmv3:uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
@ECHO OFF
set JAVA_HOME=C:\temp\xmage\java\jre1.8.0_131\bin
set CLASSPATH=%JAVA_HOME%/bin;%CLASSPATH%
set PATH=%JAVA_HOME%/bin;%PATH%
start %JAVA_HOME%\javaw.exe -Xms256m -Xmx512m -XX:MaxPermSize=384m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -jar .\lib\mage-client-1.4.26.jar
(These instructions are based on https://github.com/magarena/magarena/issues/795)
I've been searching for a solution for a while now and can only add to the above that no combination of the following options works on linux:
GDK_SCALE=2
GDK_DPI_SCALE=2
-Dsun.java2d.uiScale=2
-Dsun.java2d.dpiaware=false
Apparently the only real solution in this case is to switch to jdk9 or use run_scaled, albeit it looks a bit pixelated.
Apparently the only real solution in this case is to switch to jdk9 or use run_scaled, albeit it looks a bit pixelated.
Is this a future fix or is there a functional solution here? If it's the latter, could you provide some additional details?
@fearphage
Instead of running xmage with a version 8 jdk, use version 9 or newer.
I just tried with jdk 11, works fine.
To enable scaling, add this parameter to the command line: -Dsun.java2d.uiScale=2
@sweber83 can you give some details how you did that? What is your start command? Does everything just work?
@derlhurgoyf Here is the command I use to start xmage:
java -Xms1G -Xmx2G -Dsun.java2d.xrender=true -Dsun.java2d.uiScale=2 -jar mage-client/lib/mage-client-1.4.44.jar
I left out the exact paths to java & the .jar
file, because those will probably differ on your system.
The exact version of the jdk I use is openjdk version "11.0.7"
So far I did not experience any problems.
@sweber83 can you make example screenshots with and without that command? If it's really good then it must be added to launcher/client settings.
@JayDi85 I made two screenshots, which show the difference.
I see an issues with changing the launcher settings.
As far as I know, the launcher installs its own jdk, which is a version 8 jdk, iirc.
So that would first have to be changed to use a version 9 or newer jdk, otherwise the -Dsun.java2d.uiScale=2
command line switch does nothing.
I don't use the launcher myself, because I prefer to use the package manager of my OS, which is NixOS.
Would be great if we could respect the pixel density. I opened a pull request for Cockatrice and it didn't take much to scale all images at 2x the size on high dpi displays. Is it similarly straightforward with the framework that xmage uses? https://github.com/Cockatrice/Cockatrice/commit/5652b56b459e559862ea00bc1ee2cccb4351986a
That would be a good start.
Another possible solution, compatible with java 8:
P.S. If not helps then set same settings for java.exe file too.
Question - I run xmage on different monitors (two different TVs with vastly different scaling and sometimes just the laptop monitor). (I am reluctant to try these solutions in case it makes xmage unplayable on my laptop screen (when I don't have external TV available for a monitor.)
Is there a solution that will enable different scaling on the different monitors? Or perhaps I could create different shortcuts and thus run the one appropriate for the monitor I was using that day?
For windows you can make multiple links to javaw.exe or java.exe files and setup each link with different params and compatibility settings:
As additional you can load some registry settings by command line, see here for paths and tools (but you can run only one client that way):
reg import config-tv.reg
tv.lnk
Some usefull info from 664ac24dfd3629c1f929908d6f9d37b3626822fc
Possible use cases with DPI problems:
1 - Normal mode, user setup DPI settings by OS (example: 120%):
2 - Java 9+ gui scale mode by -Dsun.java2d.uiScale=2
3 - Windows compatibility mode with Override high DPI scaling behavior to System, see here https://github.com/magefree/mage/issues/969#issuecomment-2016809163
Current xmage problems with enabled HiDPI settings by OS -- pixelated images for mana icons, cards, texts, etc. It can be "fixed" manually by windows compatibility settings (see option 3 above) or by improved rendering code with smooth hints. The last one must be used as priority (see example code from ce439d7fcf943c07e4b5a6cab5013f6f56ce79b1).
P.S. Modes example. Maybe x2-x4 scale can be potentially good for HiDPI monitors. Need more research.
Related topic about low quality render on resize: #12276
XMage is really tiny on my shiny Hi-DPI screen on Linux (Fedora 22). It would be great if XMage scaled its interface on Hi-DPI screens (like the rest of my apps do).