aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/Window.java
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2003-10-02 18:34:56 +0000
committerThomas Fitzsimmons <fitzsim@gcc.gnu.org>2003-10-02 18:34:56 +0000
commitb59b5081384b68e33c1a50ef4d047f95e171c05d (patch)
treead4d3237b7756c048c153b6523f2ac2e1afded13 /libjava/java/awt/Window.java
parent01d28c3ff91870a620f7a5a699e509e103afb8b9 (diff)
downloadgcc-b59b5081384b68e33c1a50ef4d047f95e171c05d.zip
gcc-b59b5081384b68e33c1a50ef4d047f95e171c05d.tar.gz
gcc-b59b5081384b68e33c1a50ef4d047f95e171c05d.tar.bz2
GtkComponentPeer.java (insets): New field.
2003-10-02 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkComponentPeer.java (insets): New field. (initializeInsets): New method. (GtkComponentPeer): Call initializeInsets. Call setCursor and setBounds unconditionally. (setBounds): Convert coordinates if parent is a Window. * gnu/java/awt/peer/gtk/GtkContainerPeer.java (insets): Move field to GtkComponentPeer. (GtkContainerPeer): Don't initialize insets. * gnu/java/awt/peer/gtk/GtkDialogPeer.java (initializeInsets): New method. (create): Call new GtkWindowPeer create method. * gnu/java/awt/peer/gtk/GtkFramePeer.java (initializeInsets): New method. (create): Call new GtkWindowPeer create method. (setBounds): Remove method. (postConfigureEvent): Likewise. * gnu/java/awt/peer/gtk/GtkWindowPeer.java: Replace GTK window type constants with GDK window type constants. (create(int,boolean,int,int,GtkWindowPeer)): New method. (create(int,boolean)): Likewise. (create()): Call create(int,boolean). (nativeSetBounds): New native method declaration. (setBounds): Call native method declaration. (setSize): New native method declaration. (setBoundsCallback): Likewise. (postConfigureEvent): Handle change in insets. Call setSize and setBoundsCallback methods. * java/awt/Window.java (Window): Set visible to false. (setBoundsCallback): New method. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (gtkWidgetGetLocationOnScreen): If this component is not a container, adjust the location returned based on the peer's allocation. (set(String,boolean)): Revert change from 2003-09-19. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (awt_event_handler): Fix inset calculation. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c: Add JNI glue for Window.setBoundsCallback. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (create): Set up stacking order, window decorations and window manager hints. (setBoundsCallback): New method. (setSize): New method. (nativeSetBounds): New method. * jni/gtk-peer/gtkpeer.h: Declare setBoundsCallbackID. From-SVN: r72043
Diffstat (limited to 'libjava/java/awt/Window.java')
-rw-r--r--libjava/java/awt/Window.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
index 9f10275..3554bf5 100644
--- a/libjava/java/awt/Window.java
+++ b/libjava/java/awt/Window.java
@@ -90,6 +90,7 @@ public class Window extends Container implements Accessible
*/
Window()
{
+ visible = false;
setLayout(new BorderLayout());
}
@@ -727,4 +728,28 @@ public class Window extends Container implements Accessible
{
this.focusableWindowState = focusableWindowState;
}
+
+ // setBoundsCallback is needed so that when a user moves a window,
+ // the Window's location can be updated without calling the peer's
+ // setBounds method. When a user moves a window the peer window's
+ // location is updated automatically and the windowing system sends
+ // a message back to the application informing it of its updated
+ // dimensions. We must update the AWT Window class with these new
+ // dimensions. But we don't want to call the peer's setBounds
+ // method, because the peer's dimensions have already been updated.
+ // (Under X, having this method prevents Configure event loops when
+ // moving windows: Component.setBounds -> peer.setBounds ->
+ // postConfigureEvent -> Component.setBounds -> ... In some cases
+ // Configure event loops cause windows to jitter back and forth
+ // continuously).
+ void setBoundsCallback (int x, int y, int w, int h)
+ {
+ if (this.x == x && this.y == y && width == w && height == h)
+ return;
+ invalidate();
+ this.x = x;
+ this.y = y;
+ width = w;
+ height = h;
+ }
}