Sunday, July 22, 2012

TopCoder Arena Resizing Bug in xmonad/dwm/awesome/ratpoison (AKA The Java "Empty Grey Window" Bug)

What happened:

I recently switched to using xmonad as my main window manager, and I immediately noticed some issues with resizing the TopCoder Arena. Specifically, the main content area stayed the same size no matter how I resized the window itself. If I expanded the window, everything outside the content area would be blank grey pixels. As I soon found out, I wasn't the only person to have encountered this issue before -- the same situation is described on the TopCoder forums here and here (screenshot here).

The reason:

As it turns out, this bug applies to all Java applications running on many non-reparenting window managers (including dwm, awesome, ratpoison, etc...). According to the Arch wiki, Java has a hardcoded list of non-reparenting window managers; if you use anything outside of this list, then strange things happen.

Common fixes:

  • If you're using OpenJDK, fixing the problem should be relatively simple. You simply have to set _JAVA_AWT_WM_NONREPARENTING=1 in whichever shell you use and try logging out and logging back in. This method is independent of window manager, but I'm not sure if it works for Sun/Oracle Java.
  • You could try pretending to Java that you're using a supported non-reparenting window manager, such as LG3D. Tools such as SetWMName (xmonad only) and wmname allow you to do this.

Moar info:

  • As it turns out, there is another bug in xmonad which messes up window focus (using hotkeys, typing in text areas, etc...). A summary of the bug and some fixes can be found here. (Updated on 2012-12-02: Apparently this has been fixed by the latest commit to the DARCS version of XMonad.)
  • HaskellWiki's FAQ on xmonad
  • ArchWiki's pages on xmonad, awesome, and dwm

1 comment: