This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gui][PATCH] fix window placement
- From: Thomas Fitzsimmons <fitzsim at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Thu, 29 Apr 2004 16:43:03 -0400
- Subject: [gui][PATCH] fix window placement
Hi,
This patch fixes a problem reported by David Jee, where setLocation
wasn't working on hidden windows. I checked this in to java-gui-branch.
Tom
2004-04-29 Thomas Fitzsimmons <fitzsim@redhat.com>
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
(nativeSetBounds): Call gdk_window_move in addition to
gtk_window_move.
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,v
retrieving revision 1.24.2.3
diff -u -r1.24.2.3 gnu_java_awt_peer_gtk_GtkWindowPeer.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c 23 Apr 2004 21:37:42 -0000 1.24.2.3
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c 29 Apr 2004 20:30:46 -0000
@@ -383,7 +383,22 @@
height = (height < 1) ? 1 : height;
gdk_threads_enter ();
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);
+
/* Need to change the widget's request size. */
gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
/* Also need to call gtk_window_resize. If the resize is requested