2003-09-02 Thomas Fitzsimmons <fitzsim@redhat.com>
authorfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Sep 2003 23:04:05 +0000 (23:04 +0000)
committerfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Sep 2003 23:04:05 +0000 (23:04 +0000)
* gnu/java/awt/peer/gtk/GtkDialogPeer.java (create): Add width
and height arguments to GtkWindowPeer.create method call.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
(create(int,int,int)): New method.
(create(int)): Add call to new create method.
(create()): Add width and height arguments to create method
call.
(GtkWindowPeer): Remove call to setBounds.
* java/awt/Frame.java (Frame(String)): Initialize visible field
to false.
(Frame(GraphicsConfiguration)): Likewise.
(Frame(String,GraphicsConfiguration)): Likewise.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (create):
Add width and height parameters.  Call
gtk_window_set_default_size.
(connectHooks): Remove unused name variable.
(static setBounds): Call gtk_window_resize not
gtk_widget_set_usize.
(setBounds): Remove unused nchildren variable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71007 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
libjava/java/awt/Frame.java
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c

index bed3436..fbd37c5 100644 (file)
@@ -1,3 +1,25 @@
+2003-09-02  Thomas Fitzsimmons  <fitzsim@redhat.com>
+
+       * gnu/java/awt/peer/gtk/GtkDialogPeer.java (create): Add width
+       and height arguments to GtkWindowPeer.create method call.
+       * gnu/java/awt/peer/gtk/GtkWindowPeer.java
+       (create(int,int,int)): New method.
+       (create(int)): Add call to new create method.
+       (create()): Add width and height arguments to create method
+       call.
+       (GtkWindowPeer): Remove call to setBounds.
+       * java/awt/Frame.java (Frame(String)): Initialize visible field
+       to false.
+       (Frame(GraphicsConfiguration)): Likewise.
+       (Frame(String,GraphicsConfiguration)): Likewise.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (create):
+       Add width and height parameters.  Call
+       gtk_window_set_default_size.
+       (connectHooks): Remove unused name variable.
+       (static setBounds): Call gtk_window_resize not
+       gtk_widget_set_usize.
+       (setBounds): Remove unused nchildren variable.
+
 2003-08-31  Ingo Proetel  <proetel@aicas.com>
 
        * java/util/logging/Logger.java: provide class and method information
index cddaead..b5ea4b0 100644 (file)
@@ -53,7 +53,9 @@ public class GtkDialogPeer extends GtkWindowPeer
 
   void create ()
   {
-    create (GTK_WINDOW_POPUP);
+    create (GTK_WINDOW_POPUP,
+           awtComponent.getWidth(),
+           awtComponent.getHeight());
   }
 
   public void getArgs (Component component, GtkArgList args)
index 08c1777..7451947 100644 (file)
@@ -49,11 +49,18 @@ public class GtkWindowPeer extends GtkContainerPeer
   static protected final int GTK_WINDOW_TOPLEVEL = 0;
   static protected final int GTK_WINDOW_POPUP = 1;
 
-  native void create (int type);
+  native void create (int type, int width, int height);
+
+  void create (int type)
+  {
+    create (type, awtComponent.getWidth(), awtComponent.getHeight());
+  }
 
   void create ()
   {
-    create (GTK_WINDOW_POPUP);
+    create (GTK_WINDOW_POPUP,
+           awtComponent.getWidth(),
+           awtComponent.getHeight());
   }
 
   native void connectHooks ();
@@ -61,9 +68,6 @@ public class GtkWindowPeer extends GtkContainerPeer
   public GtkWindowPeer (Window window)
   {
     super (window);
-
-    Dimension d = window.getSize ();
-    setBounds (0, 0, d.width, d.height);
   }
 
   public void getArgs (Component component, GtkArgList args)
index 82fed16..1df9832 100644 (file)
@@ -237,12 +237,15 @@ Frame(String title)
 {
   super();
   this.title = title;
+  // Top-level frames are initially invisible.
+  visible = false;
 }
 
 public
 Frame(GraphicsConfiguration gc)
 {
   super(gc);
+  visible = false;
 }
 
 public
@@ -250,6 +253,7 @@ Frame(String title, GraphicsConfiguration gc)
 {
   super(gc);
   setTitle(title);
+  visible = false;
 }
 
 /*************************************************************************/
index 95c2bd0..35f7a20 100644 (file)
@@ -50,14 +50,16 @@ static void setBounds (GtkWidget *, jint, jint, jint, jint);
 
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create 
-  (JNIEnv *env, jobject obj, jint type)
+  (JNIEnv *env, jobject obj, jint type, jint width, jint height)
 {
-  gpointer window;
+  GtkWidget *window;
   GtkWidget *vbox, *layout;
 
   gdk_threads_enter ();
   window = gtk_window_new (type);
 
+  gtk_window_set_default_size (GTK_WINDOW(window), width, height);
+
   vbox = gtk_vbox_new (0, 0);
   layout = gtk_layout_new (NULL, NULL);
   gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
@@ -93,24 +95,23 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks
   (JNIEnv *env, jobject obj)
 {
   void *ptr;
-  GtkVBox* vbox;
-  GtkWidget *layout;
+  GtkWidget* vbox, *layout;
   GList* children;
-  char* name;
+
   ptr = NSA_GET_PTR (env, obj);
 
   gdk_threads_enter ();
 
    children = gtk_container_get_children(GTK_CONTAINER(ptr));
    vbox = children->data;
-   name = GTK_OBJECT_TYPE_NAME(vbox);
+
    if(!GTK_IS_VBOX(vbox))
      {
        printf("*** this is not a vbox\n");
      }
    children = gtk_container_get_children(GTK_CONTAINER(vbox));
    layout = children->data;
-   name = GTK_OBJECT_TYPE_NAME(layout);
+
    if(!GTK_IS_LAYOUT(layout))
      {
       printf("*** widget is not a layout ***");
@@ -147,7 +148,6 @@ setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
   gtk_widget_show (vbox);
 
   gtk_widget_realize (window);
-/*    setBounds (window, x, y, width, height); */
 
   connect_awt_hook (env, obj, 1, window->window);
   set_visible (window, visible);
@@ -233,15 +233,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
 static void
 setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height)
 {
-/*    gdk_window_get_root_origin (widget->window, &current_x, &current_y); */
-
-/*    if (current_x != x || current_y != y) */
-/*      { */
-/*        gdk_window_set_hints (widget->window, x, y, 0, 0, 0, 0, GDK_HINT_POS); */
-/*        gdk_window_move (widget->window, x, y); */
-/*      } */
-
-  gtk_widget_set_usize (widget, width, height);
+  gtk_window_resize (GTK_WINDOW(widget), width, height);
 }
 
 JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds
@@ -314,7 +306,6 @@ gdk_window_get_root_geometry (GdkWindow *window,
                              gint      *depth)
 {
   GdkWindow *private;
-  unsigned int nchildren;
   
   g_return_if_fail (window != NULL);