emichael / dslabs

Distributed Systems Labs and Framework
https://ellismichael.com/dslabs/
1.23k stars 337 forks source link

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

Open Lawqup opened 1 year ago

Lawqup commented 1 year ago

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

emichael commented 1 year ago

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 commented 1 year ago

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

Thanks!

emichael commented 1 year ago

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: https://github.com/emichael/dslabs/blob/4c3c7c6cf4a6a0547b2b1be3e3c6b4822e5c630c/framework/tst/dslabs/framework/testing/visualization/DebuggerWindow.java#L95-L122