Griefed/ServerPackCreator

[Bug]: GUI breaks on Wayland

alterNERDtive opened this issue · 21 comments

What happened?

Well, it looks like this:

image

It’s quite unusable.

What did you expect to happen?

I expected it to work ;)

Version

4.3.2

Relevant log output

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: null cannot be cast to non-null type kotlin.collections.Map<*, *>
	at de.griefed.serverpackcreator.gui.utilities.TextIcon.paintIcon(TextIcon.kt:162)
	at de.griefed.serverpackcreator.gui.utilities.RotatedIcon.paintIcon(RotatedIcon.kt:95)
	at java.desktop/javax.swing.plaf.basic.BasicButtonUI.paintIcon(BasicButtonUI.java:407)
	at java.desktop/javax.swing.plaf.basic.BasicButtonUI.paint(BasicButtonUI.java:324)
	at mdlaf.components.button.MaterialButtonUI.paint(MaterialButtonUI.java:150)
	at java.desktop/javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
	at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:842)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1119)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JViewport.paint(JViewport.java:736)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1128)
	at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:952)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5318)
	at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:246)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1337)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1105)
	at java.desktop/java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
	at java.desktop/sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:75)
	at java.desktop/sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:112)
	at java.desktop/java.awt.Container.paint(Container.java:2005)
	at java.desktop/java.awt.Window.paint(Window.java:3959)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:890)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:862)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:862)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:835)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:784)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1898)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Anything else you would like to add?

That’s the stderr output above, I can attach stdout as well if you need it. It’s all INFO though.

> cat /etc/fedora-release 
Fedora release 38 (Thirty Eight)
> rpm -q sway            
sway-1.8.1-1.fc38.x86_64
> rpm -q xorg-x11-server-Xwayland
xorg-x11-server-Xwayland-22.1.9-2.fc38.x86_64
> java --version                                              
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment (Red_Hat-17.0.8.0.7-1.fc38) (build 17.0.8+7)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.8.0.7-1.fc38) (build 17.0.8+7, mixed mode, sharing)

LMK if you need anything else.

If you are using the webservice, in which browers did you encounter this bug?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Oh yeah, it worked flawlessly before I switched from X/i3 to wayland/sway.

Guess it’s time to learn the CLI interface ;)

Huh, guess Fedora could be considered on the "unsupported OS" -list, then. Or rather, that particular gui manager. :D

Well, Wayland is the de-facto successor of Xorg; the latter is basically no longer maintained outside of emergency security fixes.

So if you don’t want to support running on Wayland, you’re going to eventually no longer support running on Linux. Which is still your choice, obviously. For now I’ll just run the CLI :)

Was more of a joke rsther than serious bizzinizz.

I need to run some tests in a VM to see if its a Java problem or a ServerPackCreator problem.
Might as well be a Java Swing problem. That'd be bad as that would mean there's not much I could do.

Was more of a joke rsther than serious bizzinizz.

Got it. No hard feelings 👍

There are people out there that take these things very seriously though so I never know ;)

Right, finally got around to it and am now setting up a Fedora38 VM. Anything I need to take care of in your opinion? Does the default installation suffice, or do I need to upgrade the desktop manager in some way?

So, at least on a default installation of Fedora38, ServerPackCreator 4.3.2 works as expected. Same for the beta of version 5, using 5.0.0-beta.5.

I actually have no idea what DE the default installation uses, and if it’s X or Wayland :)

Also I did some window resizing shenanigans on a portrait mode display, and it seems it breaks upon rendering the thing below the script variables (don’t recall what’s there, but you’ll know).

image

Dear gods, that looks, eh, yeah... :D
Would you happen to have any advice at hand in order to install sway?
At least Wayland is not the problem here.

[griefed@localhost-live ~]$ cat /etc/fedora-release 
Fedora release 38 (Thirty Eight)
[griefed@localhost-live ~]$ rpm -q sway  
package sway is not installed
[griefed@localhost-live ~]$ rpm -q xorg-x11-server-Xwayland
xorg-x11-server-Xwayland-22.1.9-1.fc38.x86_64
[griefed@localhost-live ~]$ 

Well just because you have xwayland doesn’t mean you’re running on wayland. It depends on your desktop environment, and, if it does both, the settings.

Installing sway is dnf install sway. Then select it as login session on the login srceen. super+Enter should open a shell by default, otherwise the blank config is exactly that, very blank :D

Wayland is currently being used

[griefed@fedora ~]$ echo $WAYLAND_DISPLAY
wayland-0
[griefed@fedora ~]$ loginctl
SESSION  UID USER    SEAT  TTY 
      2 1000 griefed seat0 tty2

1 sessions listed.
[griefed@fedora ~]$ loginctl show-session 2 -p Type
Type=wayland

as per https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators-guide/Wayland/#_determining_whether_you_are_using_wayland

I'll check sway.

Yep, Sway completely breaks everything.

Version 5 appears to work, though. Please give that a try: https://github.com/Griefed/ServerPackCreator/releases/tag/5.0.0-beta.6

EDIT: Nope, many areas are broken in v5 in Sway, too.

I mean … while you’re testing … there’s at least Gnome, Mate and KDE in Wayland options on Fedora left. And possibly Budgie, but IDK how far their support has grown.

Also if it’s broken on sway, that’s probably true for all wl-roots based window managers then.

So far, everything but Sway worked and so far the issue appears to come from Java itself.

Interesting. I wonder if it’s related to tiling (though it still breaks if I make the window floating within sway). Sadly there aren’t any other Wayland tiling window managers in the fedora repositories that I know of, and it worked just fine on X11/i3.

If you’re not opposed to building one yourself, there’s e.g. Hyperland, but that would be based on wlroots as well.

Not a fan of the tiling, and building my own window manager is out of the question.

I'll try and find a couple of workarounds for the errors which appear when using Sway. No promises though, as the source of the errors is in the values provided by Java itself, or rather the values not provided by Java on Fedora Sway, I won't go too deep into this.

Please give it a go with https://github.com/Griefed/ServerPackCreator/releases/tag/5.0.0-beta.9

At least on my end, using a blank install of Fedora38 Sway, it worked no matter where or how I positioned SPC.

Looking good 👍🏿

But also a bit overwhelmingly different at first glance 😬

With the release of version 5 this in considered fixed, therefore I am closing this issue.

Cheers,
Griefed