Why does Java (XWayland / Weston) resize a Window to 1x1 pixel when HDMI is unplugged (and does not resize back when HDMI is plugged)

Marius Vlad marius.vlad at collabora.com
Thu Jun 8 07:28:29 UTC 2023


Hi,

Sort of sounds like might have has been fixed with [1].

The change itself was integrated in weston 12, so you'd need to pick
that version to test it out. Debian has only only weston 11 in
experimental so you would need to either grab 12.0 branch from git, or get
it from [2]. In both case you'd have to compile it yourself. If you
manage to test it out and still see the issue, suggest to open a gitlab
ticket.

[1] https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1180
[2] https://gitlab.freedesktop.org/wayland/weston/-/releases/12.0.1

On Wed, Jun 07, 2023 at 10:25:28PM +0200, Martin Petzold wrote:
> I guess I have an issue with XWayland (but maybe Weston / Linux). It is very
> specific and I kindly ask for help.
> 
> I have a Java application running on:
> 
> XWayland 2:1.20.11-1+deb11u6, Weston 9.0.0-1, OpenJDK 11.0.18+10-1~deb11u1,
> Debian 11, Kernel 5.10.52
> 
> My JFrame (Window) is set to: GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this);
> 
> I can then see my interface on the full screen (in my case it is a TV and I
> have CEC enabled in the Kernel). However, after I UNPLUG HDMI and then PLUG
> HDMI again, my interface is gone (black screen). There is only one small 1x1
> pixel left. It seems the size of the Window is changed by Java / XWayland /
> (Weston). I am sure, that I am not changing it - I checked all resize
> methods on JFrame.
> 
> When I restart my Java application, it is back again - so it is not an issue
> of the OS (Linux) directly and also - most probably - not Weston.
> 
> I also don't have this issue with a pure Wayland application (e.g. Weston
> flower). Using only Wayland (without Java and XWayland) things work.
> 
> When I PLUG the HDMI there is NO java.awt.event.ComponentEvent
> 
> When I UNPLUG HDMI, I get the following java.awt.event.ComponentEvent:
> 
> java.awt.event.ComponentEvent[COMPONENT_RESIZED (0,0 1x1)] on frame0
> java.base/java.lang.Thread.getStackTrace(Thread.java:1602)
> java.desktop/java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:167)
> java.desktop/java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:167)
> java.desktop/java.awt.Component.processComponentEvent(Component.java:6461)
> java.desktop/java.awt.Component.processEvent(Component.java:6415)
> java.desktop/java.awt.Container.processEvent(Container.java:2263)
> java.desktop/java.awt.Window.processEvent(Window.java:2049)
> java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
> java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
> java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
> java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
> java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
> java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
> java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
> java.base/java.security.AccessController.doPrivileged(Native Method)
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
> java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
> java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
> java.base/java.security.AccessController.doPrivileged(Native Method)
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
> java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
> java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
> java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
> java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
> java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
> java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
> 
> Unfortunately I also don't know how to manipulate the size after I catched
> this event. I tried to directly set the size back, but this did not work. I
> think it may don't work because at this time HDMI is UNPLUGGED.
> 
> As I don't get any event when the HDMI is PLUGGED again, I also don't know
> when to (try to) set the size back to "normal".
> 
> Thanks,
> 
> Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20230608/eb6cb0dd/attachment.sig>


More information about the wayland-devel mailing list