* gnu/java/awt/peer/gtk/GtkFramePeer.java (menuBarHeight): Mark
private.
(setMenuBar): Grab MenuBar height and change insets.
(setBounds): Account for MenuBar height.
(postInsetsChangedEvent): Ditto.
(postSizeAllocateEvent): Remove.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
(menubar_resize_cb): Remove
(setMenuBarPeer): Remove callback.
(getMenuBarHeight): Use size requisition instead of
allocation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76633
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-01-26 Kim Ho <kho@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (menuBarHeight): Mark
+ private.
+ (setMenuBar): Grab MenuBar height and change insets.
+ (setBounds): Account for MenuBar height.
+ (postInsetsChangedEvent): Ditto.
+ (postSizeAllocateEvent): Remove.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (menubar_resize_cb): Remove
+ (setMenuBarPeer): Remove callback.
+ (getMenuBarHeight): Use size requisition instead of
+ allocation.
+
2004-01-25 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/TextArea.java: Fix indentation. Flesh out javadocs.
public class GtkFramePeer extends GtkWindowPeer
implements FramePeer
{
- int menuBarHeight = 0;
+ private int menuBarHeight;
private MenuBarPeer menuBar;
native int getMenuBarHeight (MenuBarPeer bar);
removeMenuBarPeer(menuBar);
menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
setMenuBarPeer(menuBar);
+ menuBarHeight = getMenuBarHeight (menuBar);
+ insets.top += menuBarHeight;
+ awtComponent.doLayout();
}
}
+ public void setBounds (int x, int y, int width, int height)
+ {
+ nativeSetBounds (x, y,
+ width - insets.left - insets.right,
+ height - insets.top - insets.bottom
+ + menuBarHeight);
+ }
+
public void setResizable (boolean resizable)
{
// Call setSize; otherwise when resizable is changed from true to
+ menuBarHeight);
set ("allow_shrink", resizable);
set ("allow_grow", resizable);
- }
-
- protected void postSizeAllocateEvent()
+ }
+
+ protected void postInsetsChangedEvent (int top, int left,
+ int bottom, int right)
{
- if (menuBar != null)
- {
- if (menuBarHeight != 0)
- insets.top -= menuBarHeight;
- menuBarHeight = getMenuBarHeight(menuBar);
- insets.top += menuBarHeight;
- }
- awtComponent.doLayout();
+ insets.top = top + menuBarHeight;
+ insets.left = left;
+ insets.bottom = bottom;
+ insets.right = right;
}
public GtkFramePeer (Frame frame)
static gboolean window_property_changed_cb (GtkWidget *widget,
GdkEventProperty *event,
jobject peer);
-static void menubar_resize_cb (GtkWidget *widget, GtkAllocation *alloc,
- jobject peer);
/*
* Make a new window.
void *wptr;
GtkWidget *mptr;
GtkWidget *box;
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
-
+
wptr = NSA_GET_PTR (env, obj);
mptr = NSA_GET_PTR (env, menubar);
gdk_threads_enter ();
- g_signal_connect (G_OBJECT (mptr), "size-allocate",
- G_CALLBACK (menubar_resize_cb), *gref);
box = GTK_BIN (wptr)->child;
gtk_box_pack_start (GTK_BOX (box), mptr, 0, 0, 0);
{
GtkWidget *ptr;
jint height;
+ GtkRequisition gtkreq;
ptr = NSA_GET_PTR (env, menubar);
gdk_threads_enter ();
- height = ptr->allocation.height;
+ gtk_widget_size_request (ptr, >kreq);
+
+ height = gtkreq.height;
gdk_threads_leave ();
return height;
}
return FALSE;
}
-
-static void menubar_resize_cb (GtkWidget *widget __attribute__((unused)),
- GtkAllocation *alloc __attribute__((unused)),
- jobject peer)
-{
- static int id_set = 0;
- static jmethodID postSizeAllocateEventID;
-
- if (!id_set)
- {
- jclass gtkframepeer = (*gdk_env)->FindClass (gdk_env,
- "gnu/java/awt/peer/gtk/GtkFramePeer");
- postSizeAllocateEventID = (*gdk_env)->GetMethodID (gdk_env,
- gtkframepeer,
- "postSizeAllocateEvent",
- "()V");
- id_set = 1;
- }
- gdk_threads_leave();
- (*gdk_env)->CallVoidMethod (gdk_env, peer,
- postSizeAllocateEventID);
- gdk_threads_enter();
-}