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

Visual debugger display too small on Arch with Xmonad WM #44

Open
Lawqup opened this issue Feb 19, 2023 · 3 comments
Open

Visual debugger display too small on Arch with Xmonad WM #44

Lawqup opened this issue Feb 19, 2023 · 3 comments
Labels
bug Something isn't working component:visualizer Issues and PRs relating to the new visualization tool

Comments

@Lawqup
Copy link

Lawqup commented Feb 19, 2023

Describe the bug
When running the visual debugger using either ./run-tests.py .. --debug ... or ./run-tests.py .. --start-viz ... the display is very small and cannot be resized.

Screenshots
image

Environment

  • OS: Arch Linux
  • Window manager: XMonad
  • JDK (output of java --version): openjdk 17.0.6 2023-01-17
@Lawqup Lawqup added the bug Something isn't working label Feb 19, 2023
@emichael emichael added the component:visualizer Issues and PRs relating to the new visualization tool label Feb 19, 2023
@emichael
Copy link
Owner

Ah, XMonad makes sense. I run i3 and haven't had any issues. I've also run it on GNOME without issue.

A few things:

  1. Has the visual debugger ever worked normally?
  2. Is the window maximized or did you maximize it in the past? The debugger tries to remember the size and state of the window and restores that on startup. Try wiping out ~/.java/.userPrefs/dslabs.
  3. Can you put the window into floating mode? I don't know how to do this on XMonad, but on i3 the default keyboard shortcut is Alt+Shift+Space. Does everything properly resize in floating mode?
  4. The visual debugger is a Swing application. Some quick searching suggests that this might fix the issue: https://stackoverflow.com/a/38621162/1532134

@Lawqup
Copy link
Author

Lawqup commented Feb 21, 2023

4 Fixed the issue! I wonder why this occurs....

Thanks!

@emichael
Copy link
Owner

This page has a bit more: https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Problems_with_Java_applications.2C_Applet_java_console

It appears that Xmonad is non-reparenting, and the Java GUI library doesn't properly recognize this fact.

It also looks like a better version of 4 is to set _JAVA_AWT_WM_NONREPARENTING=1 somewhere (like .profile); you might run into issues with GTK with the solution from SO.

I'm going to leave this issue open for now. I don't particularly want to install Xmonad to test, but I bet you can detect Xmonad and set the _JAVA_AWT_WM_NONREPARENTING=1 environment variable in Java. If you (or anyone else) wants to do that, the right place is likely here where there are already some other platform-specific hacks:

static {
/*
* Try to enable GPU acceleration (doesn't seem to work very well) and
* disable UI scaling.
*
* Don't enable GPU acceleration in WSL, though. It does not like it.
*/
if (!runningInWSL()) {
System.setProperty("sun.java2d.opengl", "true");
}
// Disable this for now since it doesn't seem to be useful
// System.setProperty("sun.java2d.noddraw", "true");
/*
* Disabling this because it seems to cause problems on MacOS and causes
* text to appear blurry
*/
// System.setProperty("sun.java2d.uiScale.enabled", "false");
System.setProperty("sun.java2d.win.uiScaleX", "1.0");
System.setProperty("sun.java2d.win.uiScaleX", "1.0");
/*
* MigLayout thinks it's so smart and wants to use different spacing on
* different platforms. We just want consistent behaviour. Therefore, we
* standardize on Gnome.
*/
PlatformDefaults.setPlatform(PlatformDefaults.GNOME);
}

@emichael emichael changed the title Visual debugger display too small on Arch Visual debugger display too small on Arch with Xmonad WM Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:visualizer Issues and PRs relating to the new visualization tool
Projects
None yet
Development

No branches or pull requests

2 participants