This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug AWT/16771] New: Can't change location while the component is hidden


When component is hidden, you can't change it's location.  If you
change the location while it is hidden, and then show the component,
the component will return to its last position before being hidden.

I'm attaching a test case which demonstrates this bug.

To reproduce:
1. compile the test program and run it
2. move the component somewhere in the middle of the screen
3. click on Hide Me

Expected results:
The component will be hidden for a brief second and then will be shown
again at position (100,100).

Actual results:
The component does not show up at (100,100), but it shows up at where
it was last positioned before you pressed Hide Me.

More details:
Upon inspection, it seems that the top-level Window's heavyweight
peer's location is not changed when you call setLocation() while the
it is hidden.  The reason the window is returned to its original
position is because AWT receives a GTK_CONFIGURE signal, telling it
that the component is shown at a certain position.  This results in a
call to setBoundsCallback() in Window class, which changes the Java
Window's position to match the heavyweight peer's position.
------- Additional Comments From djee at redhat dot com  2004-02-17 16:57 -------
Created an attachment (id=97769)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=97769&action=view)
test case

------- Additional Comments From fitzsim at redhat dot com  2004-02-17 17:07 -------
You may need to place the window manually.  See
GtkWindowPeer.setResizable for an example.  I couldn't figure out how
to prevent the window position from being discarded, so I just hacked
in some "re-placement" code.

I think the problem is that GTK discards position information when
GObject properties are modified.  This may be a GTK bug, but I'm not
sure.  Since Components are shown and hidden using a GObject property,
I'm starting to think this is a general problem that needs to be more
carefully examined.

------- Additional Comments From djee at redhat dot com  2004-02-24 11:59 -------
This could be a window manager issue.  When you explicitly request a
relocation of a top-level window, the window manager doesn't always
honour your request, and it may use its own window placement policy
instead.  I looked through the gtk and gdk API, but there doesn't seem
to be anything that'll allow you to force the position of a window.
------- Additional Comments From fitzsim at redhat dot com  2004-05-18 16:55 -------
Fixed on java-gui-branch.  From GtkWindowPeer.nativeSetBounds:


  gtk_window_move (GTK_WINDOW(ptr), x, y);
  /* The call to gdk_window_move is needed in addition to the call to
     gtk_window_move.  If gdk_window_move isn't called, then the
     following set of operations doesn't give the expected results:

     1. show a window
     2. manually move it to another position on the screen
     3. hide the window
     4. reposition the window with Component.setLocation
     5. show the window

     Instead of being at the position set by setLocation, the window
     is reshown at the position to which it was moved manually. */
  gdk_window_move (GTK_WIDGET (ptr)->window, x, y);


-- 
           Summary: Can't change location while the component is hidden
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: AWT
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: djee at redhat dot com
                CC: djee at redhat dot com,gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16771


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]