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

2023-06-09 Thread Michel Dänzer
On 6/8/23 19:13, Martin Petzold wrote:
> Am 08.06.23 um 14:45 schrieb Martin Petzold:
>> Am 08.06.23 um 14:37 schrieb Pekka Paalanen:
>>>
>>> FWIW, when you unplug the last display, leaving none, then there is no
>>> display area. Weston does not pretend a fake display, there just is
>>> none. I don't know how Xwayland reacts to that, and how that Java suite
>>> reacts to what Xwayland does. Those would be something to look into, if
>>> Weston upgrade does not help.
>> Yes, it must be XWayland. Maybe there is any configuration to fix it?
>>>
>>> Xwayland might have a fake something when all real displays are gone,
>>> and maybe nothing then re-associates your app window from the fake
>>> monitor to a real monitor once a real monitor appears again? No idea.
>>>
>>> Maybe check what xrandr says while you have no displays connected? That
>>> might give a clue, assuming the Java stack listens to RandR.
>>>
>>
> Interesting: It changes from XWAYLAND0 to XWAYLAND1 to XWAYLAND2 [...]

FWIW, the RandR output name should be stable as of Xwayland 23.1, assuming 
Weston reports a stable output name via the xdg_output_v1 protocol.


-- 
Earthling Michel Dänzer|  https://redhat.com
Libre software enthusiast  | Mesa and Xwayland developer



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

2023-06-09 Thread Pekka Paalanen
On Thu, 8 Jun 2023 19:13:39 +0200
Martin Petzold  wrote:

> Am 08.06.23 um 14:45 schrieb Martin Petzold:
> > Hi Pekka,
> >
> > Am 08.06.23 um 14:37 schrieb Pekka Paalanen:  
> >> On Thu, 8 Jun 2023 14:21:31 +0200
> >> Martin Petzold  wrote:
> >>  
> >>> I am fixed to this Kernel, will be hard to get Weston 12 running.  
> >> Hi,
> >>
> >> why would you say that? Did you try? Or do you mean that building
> >> Weston and a few dependencies (not kernel, not Mesa) from source is too
> >> much?  
> >
> > We are compiling our own kernel version for embedded i.MX8. Also the 
> > Debian is our custom build and we are able to adjust to other packages 
> > or compile parts. We know how to do that. However, we are fixed to 
> > 5.10.52 for several reasons. And I need to cross-compile Weston then, 
> > which is maybe challenging?
> >
> > I can try to compile on device and test. But which dependencies also 
> > need to be compiled then? XWayland? Wayland? Libraries?
> >  
> >>
> >> FWIW, when you unplug the last display, leaving none, then there is no
> >> display area. Weston does not pretend a fake display, there just is
> >> none. I don't know how Xwayland reacts to that, and how that Java suite
> >> reacts to what Xwayland does. Those would be something to look into, if
> >> Weston upgrade does not help.  
> > Yes, it must be XWayland. Maybe there is any configuration to fix it?  
> >>
> >> Xwayland might have a fake something when all real displays are gone,
> >> and maybe nothing then re-associates your app window from the fake
> >> monitor to a real monitor once a real monitor appears again? No idea.
> >>
> >> Maybe check what xrandr says while you have no displays connected? That
> >> might give a clue, assuming the Java stack listens to RandR.
> >>  
> >  
> Interesting: It changes from XWAYLAND0 to XWAYLAND1 to XWAYLAND2 and 
> also if I have it UNPLUGGED the screen is there.
> 
> HDMI PLUGGED (on boot)
> 
> xrandr --current
> Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
> XWAYLAND0 connected 1920x1080+0+0 (normal left inverted right x axis y 
> axis) 1110mm x 620mm
>     1920x1080 59.96*+
> 
> HDMI UNPLUGGED
> 
> xrandr --current
> Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
> XWAYLAND1 connected 1920x1080+0+0 (normal left inverted right x axis y 
> axis) 1150mm x 650mm
>     1920x1080 59.96*+
> 
> HDMI RE-PLUGGED
> 
> xrandr --current
> Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
> XWAYLAND2 connected 1920x1080+0+0 (normal left inverted right x axis y 
> axis) 1110mm x 620mm
>     1920x1080 59.96*+

This is interesting, but does not look like a problem in itself: the
desktop size remains reasonable at all times, even when nothing is
connected.

If upgrading to more recent upstream versions does not help, then there
are two possibilities:
- Java stack reacts strangely to the above
- Weston's XWM resizes the window strangely

We could at least confirm the Weston behaviour then.


Thanks,
pq


pgp9GchdjXzCT.pgp
Description: OpenPGP digital signature


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

2023-06-08 Thread Martin Petzold

Am 08.06.23 um 14:45 schrieb Martin Petzold:

Hi Pekka,

Am 08.06.23 um 14:37 schrieb Pekka Paalanen:

On Thu, 8 Jun 2023 14:21:31 +0200
Martin Petzold  wrote:


I am fixed to this Kernel, will be hard to get Weston 12 running.

Hi,

why would you say that? Did you try? Or do you mean that building
Weston and a few dependencies (not kernel, not Mesa) from source is too
much?


We are compiling our own kernel version for embedded i.MX8. Also the 
Debian is our custom build and we are able to adjust to other packages 
or compile parts. We know how to do that. However, we are fixed to 
5.10.52 for several reasons. And I need to cross-compile Weston then, 
which is maybe challenging?


I can try to compile on device and test. But which dependencies also 
need to be compiled then? XWayland? Wayland? Libraries?




FWIW, when you unplug the last display, leaving none, then there is no
display area. Weston does not pretend a fake display, there just is
none. I don't know how Xwayland reacts to that, and how that Java suite
reacts to what Xwayland does. Those would be something to look into, if
Weston upgrade does not help.

Yes, it must be XWayland. Maybe there is any configuration to fix it?


Xwayland might have a fake something when all real displays are gone,
and maybe nothing then re-associates your app window from the fake
monitor to a real monitor once a real monitor appears again? No idea.

Maybe check what xrandr says while you have no displays connected? That
might give a clue, assuming the Java stack listens to RandR.



Interesting: It changes from XWAYLAND0 to XWAYLAND1 to XWAYLAND2 and 
also if I have it UNPLUGGED the screen is there.


HDMI PLUGGED (on boot)

xrandr --current
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND0 connected 1920x1080+0+0 (normal left inverted right x axis y 
axis) 1110mm x 620mm

   1920x1080 59.96*+

HDMI UNPLUGGED

xrandr --current
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND1 connected 1920x1080+0+0 (normal left inverted right x axis y 
axis) 1150mm x 650mm

   1920x1080 59.96*+

HDMI RE-PLUGGED

xrandr --current
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND2 connected 1920x1080+0+0 (normal left inverted right x axis y 
axis) 1110mm x 620mm

   1920x1080 59.96*+

Thanks,

Martin



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

2023-06-08 Thread Daniel Stone
On Thu, 8 Jun 2023 at 16:54, Martin Petzold  wrote:

> Am 08.06.23 um 16:58 schrieb Daniel Stone:
>
> On Thu, 8 Jun 2023 at 14:28, Pekka Paalanen  wrote:
>
>> On Thu, 8 Jun 2023 14:49:37 +0200
>> Martin Petzold  wrote:
>> > btw. we are using a Weston 9 package from NXP and there may be
>> important
>> > fixes for our i.MX8 platform in there.
>>
>> Oh. We cannot support modified Weston, sorry. Significant vendor
>> modifications tend to break things, and we have no idea what they do or
>> why. Maybe this problem is not because of that, maybe it is, hard to
>> guess.
>
>
> The good news is that mainline Linux runs very well on all i.MX6, and most
> i.MX8 platforms. You can ditch the NXP BSP and just use a vanilla Yocto
> build for your machine. This will have upstream Weston which should solve
> your problem.
>
> Do you mean Linux mainline or Yocto mainline?
>
> Because we are building from Debian and not from Yocto, for several
> reasons. We have a more complex system setup.
>
Ah, I wasn't aware they also had Debian distributions. Nice. Yes, I mean
mainline of upstream Linux + Mesa + Weston (plus GStreamer etc if you want
to use that). That's worked very well out of the box for a few years now
with no vendor trees required.

Cheers,
Daniel


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

2023-06-08 Thread Martin Petzold

Am 08.06.23 um 16:58 schrieb Daniel Stone:

Hi,

On Thu, 8 Jun 2023 at 14:28, Pekka Paalanen  wrote:

On Thu, 8 Jun 2023 14:49:37 +0200
Martin Petzold  wrote:
> btw. we are using a Weston 9 package from NXP and there may be
important
> fixes for our i.MX8 platform in there.

Oh. We cannot support modified Weston, sorry. Significant vendor
modifications tend to break things, and we have no idea what they
do or
why. Maybe this problem is not because of that, maybe it is, hard to
guess.


The good news is that mainline Linux runs very well on all i.MX6, and 
most i.MX8 platforms. You can ditch the NXP BSP and just use a vanilla 
Yocto build for your machine. This will have upstream Weston which 
should solve your problem.



Do you mean Linux mainline or Yocto mainline?

Because we are building from Debian and not from Yocto, for several 
reasons. We have a more complex system setup.


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

2023-06-08 Thread Daniel Stone
Hi,

On Thu, 8 Jun 2023 at 14:28, Pekka Paalanen  wrote:

> On Thu, 8 Jun 2023 14:49:37 +0200
> Martin Petzold  wrote:
> > btw. we are using a Weston 9 package from NXP and there may be important
> > fixes for our i.MX8 platform in there.
>
> Oh. We cannot support modified Weston, sorry. Significant vendor
> modifications tend to break things, and we have no idea what they do or
> why. Maybe this problem is not because of that, maybe it is, hard to
> guess.


The good news is that mainline Linux runs very well on all i.MX6, and most
i.MX8 platforms. You can ditch the NXP BSP and just use a vanilla Yocto
build for your machine. This will have upstream Weston which should solve
your problem.

Cheers,
Daniel


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

2023-06-08 Thread Pekka Paalanen
On Thu, 8 Jun 2023 14:49:37 +0200
Martin Petzold  wrote:

> Am 08.06.23 um 14:45 schrieb Martin Petzold:
> > Hi Pekka,
> >
> > Am 08.06.23 um 14:37 schrieb Pekka Paalanen:  
> >> On Thu, 8 Jun 2023 14:21:31 +0200
> >> Martin Petzold  wrote:
> >>  
> >>> I am fixed to this Kernel, will be hard to get Weston 12 running.  
> >> Hi,
> >>
> >> why would you say that? Did you try? Or do you mean that building
> >> Weston and a few dependencies (not kernel, not Mesa) from source is too
> >> much?  
> >
> > We are compiling our own kernel version for embedded i.MX8. Also the 
> > Debian is our custom build and we are able to adjust to other packages 
> > or compile parts. We know how to do that. However, we are fixed to 
> > 5.10.52 for several reasons. And I need to cross-compile Weston then, 
> > which is maybe challenging?

Upstream Weston has very little to no dependencies on kernel version.

> >
> > I can try to compile on device and test. But which dependencies also 
> > need to be compiled then? XWayland? Wayland? Libraries?

wayland-protocols, wayland, libdrm. Those are the most likely
dependencies. All really tiny and safe to upgrade from upstream version
to upstream version.

Upgrading Xwayland alone could be a try.

Xwayland has no configuration at all.

xrandr does work read-only with Xwayland. It can report the monitor
layout, but it cannot modify it. I was interested in what it reports
after that unplug, not as a workaround.

> >  
> btw. we are using a Weston 9 package from NXP and there may be important 
> fixes for our i.MX8 platform in there.

Oh. We cannot support modified Weston, sorry. Significant vendor
modifications tend to break things, and we have no idea what they do or
why. Maybe this problem is not because of that, maybe it is, hard to
guess.


Thanks,
pq


pgphpX7lhwMeW.pgp
Description: OpenPGP digital signature


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

2023-06-08 Thread Martin Petzold

Am 08.06.23 um 14:45 schrieb Martin Petzold:

Hi Pekka,

Am 08.06.23 um 14:37 schrieb Pekka Paalanen:

On Thu, 8 Jun 2023 14:21:31 +0200
Martin Petzold  wrote:


I am fixed to this Kernel, will be hard to get Weston 12 running.

Hi,

why would you say that? Did you try? Or do you mean that building
Weston and a few dependencies (not kernel, not Mesa) from source is too
much?


We are compiling our own kernel version for embedded i.MX8. Also the 
Debian is our custom build and we are able to adjust to other packages 
or compile parts. We know how to do that. However, we are fixed to 
5.10.52 for several reasons. And I need to cross-compile Weston then, 
which is maybe challenging?


I can try to compile on device and test. But which dependencies also 
need to be compiled then? XWayland? Wayland? Libraries?


btw. we are using a Weston 9 package from NXP and there may be important 
fixes for our i.MX8 platform in there.


Thanks,

Martin



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

2023-06-08 Thread Martin Petzold

Hi Pekka,

Am 08.06.23 um 14:37 schrieb Pekka Paalanen:

On Thu, 8 Jun 2023 14:21:31 +0200
Martin Petzold  wrote:


I am fixed to this Kernel, will be hard to get Weston 12 running.

Hi,

why would you say that? Did you try? Or do you mean that building
Weston and a few dependencies (not kernel, not Mesa) from source is too
much?


We are compiling our own kernel version for embedded i.MX8. Also the 
Debian is our custom build and we are able to adjust to other packages 
or compile parts. We know how to do that. However, we are fixed to 
5.10.52 for several reasons. And I need to cross-compile Weston then, 
which is maybe challenging?


I can try to compile on device and test. But which dependencies also 
need to be compiled then? XWayland? Wayland? Libraries?




FWIW, when you unplug the last display, leaving none, then there is no
display area. Weston does not pretend a fake display, there just is
none. I don't know how Xwayland reacts to that, and how that Java suite
reacts to what Xwayland does. Those would be something to look into, if
Weston upgrade does not help.

Yes, it must be XWayland. Maybe there is any configuration to fix it?


Xwayland might have a fake something when all real displays are gone,
and maybe nothing then re-associates your app window from the fake
monitor to a real monitor once a real monitor appears again? No idea.

Maybe check what xrandr says while you have no displays connected? That
might give a clue, assuming the Java stack listens to RandR.

Does xrandr really work with XWayland? I didn't install it with our 
change to Weston.


Thanks,

Martin



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

2023-06-08 Thread Pekka Paalanen
On Thu, 8 Jun 2023 14:21:31 +0200
Martin Petzold  wrote:

> I am fixed to this Kernel, will be hard to get Weston 12 running.

Hi,

why would you say that? Did you try? Or do you mean that building
Weston and a few dependencies (not kernel, not Mesa) from source is too
much?

FWIW, when you unplug the last display, leaving none, then there is no
display area. Weston does not pretend a fake display, there just is
none. I don't know how Xwayland reacts to that, and how that Java suite
reacts to what Xwayland does. Those would be something to look into, if
Weston upgrade does not help.

Xwayland might have a fake something when all real displays are gone,
and maybe nothing then re-associates your app window from the fake
monitor to a real monitor once a real monitor appears again? No idea.

Maybe check what xrandr says while you have no displays connected? That
might give a clue, assuming the Java stack listens to RandR.


Thanks,
pq


pgpA9RkBMnGd2.pgp
Description: OpenPGP digital signature


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

2023-06-08 Thread Martin Petzold

Hi,

Am 08.06.23 um 09:28 schrieb Marius Vlad:

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.
the related error is a little different. I am not changing any size, it 
happens on HDMI plug and unplug. However, it may be related and the cause.


I am fixed to this Kernel, will be hard to get Weston 12 running. Any 
idea for a work-around?


Thanks,

Martin


[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


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

2023-06-08 Thread Marius Vlad
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


signature.asc
Description: PGP signature


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

2023-06-07 Thread Martin Petzold
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