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
This commit is contained in:
Thomas Fitzsimmons 2003-10-02 18:34:56 +00:00 committed by Thomas Fitzsimmons
parent 01d28c3ff9
commit b59b508138
12 changed files with 316 additions and 107 deletions

View file

@ -42,6 +42,7 @@ import java.awt.Component;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Insets;
import java.awt.MenuBar;
import java.awt.Rectangle;
import java.awt.event.PaintEvent;
@ -69,9 +70,19 @@ public class GtkFramePeer extends GtkWindowPeer
super (frame);
}
void initializeInsets ()
{
// Unfortunately, X does not provide a clean way to calculate the
// dimensions of a frame's borders before it has been displayed.
// So we guess and then fix the dimensions upon receipt of the
// first configure event.
insets = new Insets (20, 6, 6, 6);
}
void create ()
{
create (GTK_WINDOW_TOPLEVEL);
// Create a normal decorated window.
create (GDK_WINDOW_TYPE_HINT_NORMAL, true);
}
public void getArgs (Component component, GtkArgList args)
@ -97,26 +108,8 @@ public class GtkFramePeer extends GtkWindowPeer
return g;
}
public void setBounds (int x, int y, int width, int height)
{
super.setBounds (0, 0, width - insets.left - insets.right,
height - insets.top - insets.bottom + menuBarHeight);
}
protected void postConfigureEvent (int x, int y, int width, int height,
int top, int left, int bottom, int right)
{
if (((Frame)awtComponent).getMenuBar () != null)
{
menuBarHeight = getMenuBarHeight ();
top += menuBarHeight;
}
super.postConfigureEvent (0, 0,
width + left + right,
height + top + bottom - menuBarHeight,
top, left, bottom, right);
}
// FIXME: When MenuBars work, override postConfigureEvent and
// setBounds to account for MenuBar dimensions.
protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger)
@ -128,8 +121,6 @@ public class GtkFramePeer extends GtkWindowPeer
protected void postExposeEvent (int x, int y, int width, int height)
{
// System.out.println ("x + insets.left:" + (x + insets.left));
// System.out.println ("y + insets.top :" + (y + insets.top));
q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
new Rectangle (x + insets.left,
y + insets.top,