Bug 816 - GLCanvas and NewtCanvasAWT Positioned permanently on lower left corner
Summary: GLCanvas and NewtCanvasAWT Positioned permanently on lower left corner
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: macosx (show other bugs)
Version: 2
Hardware: All macosx
: --- critical
Assignee: Sven Gothel
URL:
Depends on: 928 937
Blocks: 889 906
  Show dependency treegraph
 
Reported: 2013-08-15 18:59 CEST by Bassel Morcos
Modified: 2014-01-12 04:29 CET (History)
1 user (show)

See Also:
Type: ---
SCM Refs:
4b5435c68c3f12d62dadb395957362eceacfb25c 9a8f9b9f7e6148b60b6f0f4326df8d213774284c 3abff83dbc0a99c8d227788c9dddbe59cd15b9ba a2a057406ff5d21499860e8fef6ba88f07d9bf95 60968cdc388b6a7464da3a6b58f25cb61e29f681 7f7275834922b9c30aec6520dc5c5f20939a49d8 e9ce2246c947cc357fef993003008fe4c6a0495f ae103ba597464ca25071950af7afe012e2b86c13
Workaround: ---


Attachments
2 canvas side by side (5.67 KB, application/zip)
2013-08-28 02:00 CEST, Kenny Sabir
Details
2 canvases side by side (5.86 KB, application/zip)
2013-08-28 02:15 CEST, Kenny Sabir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bassel Morcos 2013-08-15 18:59:20 CEST
Adding a GLCanvas to a swing component like JPanel forces the glcanvas to be displayed at the lower left bottom corner of the window.

Even if forced to go to location(x,y) it pops back in the bottom position.

Resizing the window and performing the reshape fixes the problem until the resize operation stops, the canvas is back in the bottom position.

This seems to be related to oracle's bug fix:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=2229714

Note: This happens using Oracle jdk7U40b08 and above.

Testing the same piece of code (canvas in a JPanel) on jdk7u9 works perfectly.
Comment 1 Kenny Sabir 2013-08-28 02:00:45 CEST
Created attachment 496 [details]
2 canvas side by side

This demo shows 2 GLCanvases side by side. On JOGL 2.0rc11 they display correctly side by side (after an initial resize jiggle), and JOGL 2.0.2 they are always both in the bottom left corner.
Comment 2 Kenny Sabir 2013-08-28 02:15:03 CEST
Created attachment 497 [details]
2 canvases side by side


Cleaned up the testcase code. Uses a BoxLayout, though it fails on other layouts too.
Comment 3 Sven Gothel 2013-09-09 19:41:24 CEST
Also see:
  <http://forum.jogamp.org/Mac-OS-X-10-7-Oracle-JRE-7-Swing-integration-issues-td4027780.html#a4029292>

Testing w/ JDK 7u40 fcs b40 .. with enabling/disabling our existing workaround
  - 'jdk-7u40-fcs-bin-b40-macosx-x86_64-16_aug_2013'
Comment 4 Sven Gothel 2013-09-24 23:16:15 CEST
Fix OSX CALayer 'quirks' for AWT 1.7.0_40 - See JAWTUtil JAWT_OSX_CALAYER_QUIRK_SIZE and JAWT_OSX_CALAYER_QUIRK_POSITION.

    - Provide quirk bits for OSX CALayer depending on used JVM/AWT
      and act accordingly.
    
    - TestBug816OSXCALayerPosAWT: Add resize by frame

.. see git commit
Comment 5 Bassel Morcos 2013-09-25 17:06:50 CEST
Sven,

I got the latest build (#1081) to test, I downloaded the produced glugen,gluegen-natives, jogl-all, jogl-all-natives for mac.

I still have the same issue as before.

Is there something I need to do to enable "QUIRKS" mode?

I Looked at the test submitted, and it doesn't look like Any settings need to be put in place.

Best,

Bassel
Comment 6 Bassel Morcos 2013-09-25 17:38:23 CEST
Sven,

Your changes Work like a charm!

I was using jdk 40 ea build 40, and when I debugged, the Platform.JAVA_UPDATE returned a 0 instead of 40 so it didn't detect it. I downloaded and installed the officially released jdk from oracle, and everything works.

I'm pleasantly surprised by the speed you guys respond to bugs.

Thanks again!

Best,

Bassel
Comment 7 Sven Gothel 2013-09-27 10:29:03 CEST
Issue not solved to 7u40 for all cases .. WIP
Comment 9 Sven Gothel 2013-09-27 15:32:45 CEST
http://jogamp.org/git/?p=jogl.git;a=commit;h=3abff83dbc0a99c8d227788c9dddbe59cd15b9ba

.. fixed issue w/ vZome.
Comment 10 Sven Gothel 2013-09-28 04:34:25 CEST
Bug 816: Clarify JAWT_OSX_CALAYER_QUIRK_* semantics, add JAWT_OSX_CALAYER_QUIRK_LAYOUT
Comment 11 Sven Gothel 2013-10-03 15:20:47 CEST
Emmanuel Puybaret provided 2 more tests showing code still incorrect.
Comment 12 Sven Gothel 2013-10-03 15:21:29 CEST
    Bug 816 (OSX CALayer pos): Fix location on 'inner CALayer' calculation
    
    'inner CALayer' is the outter AWT Window client space (content).
    
    +++
    
    Pseudo-Code:
      p0 = c.locationOnScreen();
      p0 -= c.getOutterComp.getPos();
      p0 -= c.getOutterComp.getInsets();
    
    Where 'locationOnScreen()' is:
     p0 = 0/0;
     while( null != c ) {
       p0 += c.getPos();
     }
    
    +++
    
    JAWTWindow.getLocationOnScreenNonBlocking(..) validated against
    AWT's Component.getLocationOnScreen() - OK for all use-cases.
    (Validation enabled w/ DEBUG)
    
    All unit tests manually validated on OSX 10.7 w/ jdk7u40.
Comment 13 Sven Gothel 2013-10-03 15:35:52 CEST
Add detailed description (pseudo code) to JAWTUtil.JAWT_OSX_CALAYER_QUIRK_LAYOUT
Comment 14 Sven Gothel 2013-10-05 16:16:30 CEST
getLocationOnScreenNonBlocking(..): stop traversing at top-level heavyweight Window, 
fixes [J]Dialog use case.
    
Top-level heavyweight Window's position is it's position on screen, hence stop traversing.