Bug 1431

Summary: JOGL 2.4 + X11: NewtCanvasAWT resize is completely broken
Product: [JogAmp] Newt Reporter: crougier
Component: x11Assignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: critical CC: danny.koernig
Priority: P2    
Version: 2.6.0   
Hardware: All   
OS: all   
Type: DEFECT SCM Refs:
a0e6d5883de009d4649d011633090d7660fa229a
Workaround: ---
Attachments: JOGLQuadNewt example
Screenshot

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]
Screenshot
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
com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT
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.