<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>1221</bug_id>
          
          <creation_ts>2015-09-18 15:52:23 +0200</creation_ts>
          <short_desc>Window reports wrong position after size restored from maximized on X11</short_desc>
          <delta_ts>2015-09-27 01:23:54 +0200</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Newt</product>
          <component>x11</component>
          <version>2.3.2</version>
          <rep_platform>pc_x86_64</rep_platform>
          <op_sys>linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Colin DuPée">Pragmataraxia</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          
          
          <cf_type>---</cf_type>
          <cf_scm_refs></cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>5153</commentid>
    <comment_count>0</comment_count>
      <attachid>737</attachid>
    <who name="Colin DuPée">Pragmataraxia</who>
    <bug_when>2015-09-18 15:52:23 +0200</bug_when>
    <thetext>Created attachment 737
Simple windows spits out bounds info to stdout on move/resize/click.

This is really several bugs, but they&apos;re likely related.  For all of the above, simply have a GLWindow visible.

1) Reported position after maximize/restore
- Move window to non-default position.
- Double-click title bar to maximize.
- Double-click title bar to restore.

  Result: Window returns to original position, but getX()/getY() report another position.

  If you register a WindowListener, you can see that 3 events appear upon restore, the middle of which is the correct position, but the first and last are wrong.

2) WindowListener&apos;s windowResize() receives no updates until mouse released.
  Expected: new event arrives when window changes size.
Observed: no events appear until mouse is released, then entire queue of updates are delivered.

Neither of these problems appear on Windows.

As a bonus bug for all platforms...

3) Iterative getting/setting position results in windows moving upward.
  I have no details on this one yet, so I can&apos;t really file it yet, but I have a number of windows where I try to save their positions, and restore them when the application is re-launched.  Sometimes, the restored windows have moved upward about the thickness of the window decorations.  It happens infrequently enough that I&apos;m not even sure if the problem is in get or set, but it&apos;s driving me bonkers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5186</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-09-22 05:11:28 +0200</bug_when>
    <thetext>(In reply to Colin DuPée from comment #0)
&gt; Created attachment 737 [details]
&gt; Simple windows spits out bounds info to stdout on move/resize/click.
&gt; 
&gt; This is really several bugs, but they&apos;re likely related.  For all of the
&gt; above, simply have a GLWindow visible.
&gt; 
&gt; 1) Reported position after maximize/restore
&gt; - Move window to non-default position.
&gt; - Double-click title bar to maximize.
&gt; - Double-click title bar to restore.
&gt; 
&gt;   Result: Window returns to original position, but getX()/getY() report
&gt; another position.
&gt; 
&gt;   If you register a WindowListener, you can see that 3 events appear upon
&gt; restore, the middle of which is the correct position, but the first and last
&gt; are wrong.

I will look into this.
This reported issue seems to be valid.

&gt; 
&gt; 2) WindowListener&apos;s windowResize() receives no updates until mouse released.
&gt;   Expected: new event arrives when window changes size.
&gt; Observed: no events appear until mouse is released, then entire queue of
&gt; updates are delivered.
&gt; 
&gt; Neither of these problems appear on Windows.

This depends on the native window manager, not NEWT.
We deliver all resize events on X11, OSX, ..

&gt; 
&gt; As a bonus bug for all platforms...
&gt; 
&gt; 3) Iterative getting/setting position results in windows moving upward.
&gt;   I have no details on this one yet, so I can&apos;t really file it yet, but I
&gt; have a number of windows where I try to save their positions, and restore
&gt; them when the application is re-launched.  Sometimes, the restored windows
&gt; have moved upward about the thickness of the window decorations.  It happens
&gt; infrequently enough that I&apos;m not even sure if the problem is in get or set,
&gt; but it&apos;s driving me bonkers.

&quot;Iterative getting/setting position&quot; I assume you mean
programmatically setting the position here.

Please check the API doc of NEWT, e.g.:

Window.setPosition(..):

&apos;Sets the location of the window&apos;s client area excluding insets (window decorations) in window units.&apos;

&lt;http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/Window.html#setPosition%28int,%20int%29&gt;

Hence you would need to take the window decoration into account, 
see the convenient methods:

Window.setTopLevelPosition(..)
&lt;http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/Window.html#setTopLevelPosition%28int,%20int%29&gt;

.. there is also an: Window.setTopLevelSize(..).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5188</commentid>
    <comment_count>2</comment_count>
    <who name="Colin DuPée">Pragmataraxia</who>
    <bug_when>2015-09-22 06:18:38 +0200</bug_when>
    <thetext>&gt; This depends on the native window manager, not NEWT.
&gt; We deliver all resize events on X11, OSX, ..

I wondered if that might be the case.  This particular machine is using LXDE, in case that&apos;s ever relevant to anyone.

&gt; Hence you would need to take the window decoration into account

The setTopLevel*() methods are useful, but are there related getTopLevel*() methods to go with them?

Just to clarify, the problem isn&apos;t that the windows move up with each setPosition(), the incorrect behavior happens only rarely; which is much worse.  The only reason I haven&apos;t filed it as a real report yet is that because it&apos;s rare, I don&apos;t know if the problem is with setPosition() or getBounds().  I&apos;ve promised the guys in the lab a doughnut if they can find a way to reproduce this problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5189</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-09-22 06:29:57 +0200</bug_when>
    <thetext>(In reply to Colin DuPée from comment #2)
&gt; &gt; This depends on the native window manager, not NEWT.
&gt; &gt; We deliver all resize events on X11, OSX, ..
&gt; 
&gt; I wondered if that might be the case.  This particular machine is using
&gt; LXDE, in case that&apos;s ever relevant to anyone.
&gt; 
&gt; &gt; Hence you would need to take the window decoration into account
&gt; 
&gt; The setTopLevel*() methods are useful, but are there related getTopLevel*()
&gt; methods to go with them?
Nope :)

Since .. well, we can think about it.
However, adding two new methods in favor of adding the insets
is a bit too lazy :)

&gt; 
&gt; Just to clarify, the problem isn&apos;t that the windows move up with each
&gt; setPosition(), the incorrect behavior happens only rarely; which is much
&gt; worse.  The only reason I haven&apos;t filed it as a real report yet is that
&gt; because it&apos;s rare, I don&apos;t know if the problem is with setPosition() or
&gt; getBounds().  I&apos;ve promised the guys in the lab a doughnut if they can find
&gt; a way to reproduce this problem.

I never liked this kind of bakery :)

Don&apos;t forget that on X11, we can only _request_ a window position,
where the WM is not required to fulfill our wishes.
This may reflect the rare reproduction of the issue.

On a side note, always consider contracting us if appropriate :)
  &lt;https://jogamp.org/wiki/index.php/Maintainer_and_Contacts#Sven_Gothel&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5248</commentid>
    <comment_count>4</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-09-26 06:44:54 +0200</bug_when>
    <thetext>(In reply to Sven Gothel from comment #1)
&gt; (In reply to Colin DuPée from comment #0)
&gt; &gt; Created attachment 737 [details]
&gt; &gt; Simple windows spits out bounds info to stdout on move/resize/click.
&gt; &gt; 
&gt; &gt; This is really several bugs, but they&apos;re likely related.  For all of the
&gt; &gt; above, simply have a GLWindow visible.
&gt; &gt; 
&gt; &gt; 1) Reported position after maximize/restore
&gt; &gt; - Move window to non-default position.
&gt; &gt; - Double-click title bar to maximize.
&gt; &gt; - Double-click title bar to restore.
&gt; &gt; 
&gt; &gt;   Result: Window returns to original position, but getX()/getY() report
&gt; &gt; another position.
&gt; &gt; 
&gt; &gt;   If you register a WindowListener, you can see that 3 events appear upon
&gt; &gt; restore, the middle of which is the correct position, but the first and last
&gt; &gt; are wrong.
&gt; 
&gt; I will look into this.
&gt; This reported issue seems to be valid.
&gt; 

Tested on GNU/Linux x86_64, Debian 8, KDE WM, NV driver
using com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT.
(The latter shows bounds in title bar and prints it)

Cannot confirm, either via mouse-click maximize,
nor programmatic pressing &apos;m&apos;.

Tested w/ latest tip of master branch.

Closing .. pls reopen if you can reproduce it,
in such case you would need to give more details.

WM: KDE and/or Gnome. 
If it fails w/ others .. we shall ignore it.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>737</attachid>
            <date>2015-09-18 15:52:23 +0200</date>
            <delta_ts>2015-09-18 15:52:23 +0200</delta_ts>
            <desc>Simple windows spits out bounds info to stdout on move/resize/click.</desc>
            <filename>TestNewt.java</filename>
            <type>text/plain</type>
            <size>3280</size>
            <attacher name="Colin DuPée">Pragmataraxia</attacher>
            
              <data encoding="base64">cGFja2FnZSBjb20udGRtZC50ZXN0OwoKaW1wb3J0IGNvbS5qb2dhbXAubmF0aXZld2luZG93LnV0
aWwuUmVjdGFuZ2xlOwppbXBvcnQgY29tLmpvZ2FtcC5uZXd0LkRpc3BsYXk7CmltcG9ydCBjb20u
am9nYW1wLm5ld3QuTmV3dEZhY3Rvcnk7CmltcG9ydCBjb20uam9nYW1wLm5ld3QuU2NyZWVuOwpp
bXBvcnQgY29tLmpvZ2FtcC5uZXd0LldpbmRvdzsKaW1wb3J0IGNvbS5qb2dhbXAubmV3dC5ldmVu
dC5Nb3VzZUV2ZW50OwppbXBvcnQgY29tLmpvZ2FtcC5uZXd0LmV2ZW50Lk1vdXNlTGlzdGVuZXI7
CmltcG9ydCBjb20uam9nYW1wLm5ld3QuZXZlbnQuV2luZG93RXZlbnQ7CmltcG9ydCBjb20uam9n
YW1wLm5ld3QuZXZlbnQuV2luZG93TGlzdGVuZXI7CmltcG9ydCBjb20uam9nYW1wLm5ld3QuZXZl
bnQuV2luZG93VXBkYXRlRXZlbnQ7CmltcG9ydCBjb20uam9nYW1wLm5ld3Qub3BlbmdsLkdMV2lu
ZG93OwppbXBvcn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