Bug 1431 - JOGL 2.4 + X11: NewtCanvasAWT resize is completely broken
Summary: JOGL 2.4 + X11: NewtCanvasAWT resize is completely broken
Alias: None
Product: Newt
Classification: JogAmp
Component: x11 (show other bugs)
Version: 2.6.0
Hardware: All all
: P2 critical
Assignee: Sven Gothel
Depends on:
Reported: 2023-03-15 12:17 CET by crougier
Modified: 2023-09-29 00:09 CEST (History)
1 user (show)

See Also:
SCM Refs:
Workaround: ---

JOGLQuadNewt example (3.50 KB, text/plain)
2023-03-15 12:17 CET, crougier
Screenshot (6.61 KB, image/png)
2023-03-15 12:18 CET, crougier

Note You need to log in before you can comment on or make changes to this bug.
Description crougier 2023-03-15 12:17:03 CET
Created attachment 857 [details]
JOGLQuadNewt example

Each time NewtCanvasAWT is resized, the viewport moves down and to the right and the rendering eventually disappears.
It can be reproduced with the attached JOGLQuadNewt example with JOGL 2.4.0 on Ubuntu. No issue with JOGL 2.3.2.
Tested on Ubuntu 20.04 with OpenJDK 11.0.12+7 and OpenJDK 17.0.6+10.
Comment 1 crougier 2023-03-15 12:18:22 CET
Created attachment 858 [details]
Comment 2 Sven Gothel 2023-09-28 08:48:15 CEST
Thank you, I will look at at soon.
Comment 3 Sven Gothel 2023-09-28 10:44:57 CEST
Reproduced with given test as well as with out unit test
Comment 4 Sven Gothel 2023-09-28 14:59:59 CEST
(In reply to Sven Gothel from comment #3)
Culprit is commit ad38d1559854985b1131e5b6c7274a392b5bc265
Comment 5 Sven Gothel 2023-09-29 00:09:25 CEST
commit a0e6d5883de009d4649d011633090d7660fa229a

Bug 1431: Fix NewtCanvasAWT resize on X11, broken since commit ad38d1559854985b1131e5b6c7274a392b5bc265
Commit ad38d1559854985b1131e5b6c7274a392b5bc265 introduced XTranslateCoordinates(..) to safely validate
the client-space window position against the parent (root).
Totally missing in this change was the NEWT child window case
since it always used the root-window as the destination.
This change tracks the parent-window (valid parent Window or NULL)
within the JavaWindow struct and either uses the parent-window
if available or the root-window for XTranslateCoordinates(..).
This results in the proper client-space position.
Validated against
- TestGearsES2NewtCanvasAWT
- TestBug1431NewtCanvasAWT
on Debian 12 w/ Java17.