GtkButtonPeer.java (handleEvent): Remove modality check.

2003-10-08  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/awt/peer/gtk/GtkButtonPeer.java (handleEvent): Remove
	modality check.
	* gnu/java/awt/peer/gtk/GtkDialogPeer.java (initializeInsets):
	Initialize insets to use latest insets.
	* gnu/java/awt/peer/gtk/GtkFramePeer.java: Likewise.
	* gnu/java/awt/peer/gtk/GtkWindowPeer.java (latestInsets): New
	field.
	(postConfigureEvent): Update latestInsets field when insets
	change.  Remove call to setSize.  Move validate call outside of
	if blocks.
	(setVisible): Call setBounds before showing window.
	(nativeSetVisible): New native method.
	* java/awt/Window.java (show): Show visible owned windows.
	(hide): Hide visible owned windows.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
	(awt_event_handler): Implement modality using GTK grabs.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
	(global_gtk_window_group): New global variable.
	(gtkInit): Initialize global_gtk_window_group.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (create):
	Clamp width and height values to at least 1.  Add this window to
	the global GTK window group.
	(setVisible): Rename to nativeSetVisible.
	(setup_window): Remove function.
	(setSize): Clamp width and height values to at least 1.
	(nativeSetBounds): Likewise.
	(gdk_window_get_root_geometry): Remove function.
	* jni/gtk-peer/gtkpeer.h: Remove gdk_window_get_root_geometry
	and setup_window declarations.  Declare global_gtk_window_group.

From-SVN: r72252
This commit is contained in:
Thomas Fitzsimmons 2003-10-09 00:26:29 +00:00 committed by Thomas Fitzsimmons
parent ba401f2f1f
commit 23a555b077
10 changed files with 185 additions and 123 deletions

View file

@ -56,6 +56,15 @@ public class GtkWindowPeer extends GtkContainerPeer
static protected final int GDK_WINDOW_TYPE_HINT_DOCK = 6;
static protected final int GDK_WINDOW_TYPE_HINT_DESKTOP = 7;
// Unfortunately, X does not provide a clean way to calculate the
// dimensions of a window's borders before it has been displayed.
// So when creating the application's first window we guess the
// border dimensions. Then if need be for that window, we fix the
// dimensions upon receipt of the first configure event. Windows
// created after the first one will use the latest inset values
// received in postConfigureEvent.
static Insets latestInsets = new Insets (20, 6, 6, 6);
native void create (int type, boolean decorated,
int width, int height,
GtkWindowPeer parent);
@ -109,18 +118,19 @@ public class GtkWindowPeer extends GtkContainerPeer
set ("title", title);
}
native void setSize (int width, int height);
public void setResizable (boolean resizable)
{
// Call setSize; otherwise when resizable is changed from true to
// false the window will shrink to the dimensions it had before it
// was resizable.
setSize (awtComponent.getWidth() - insets.left - insets.right,
awtComponent.getHeight() - insets.top - insets.bottom);
awtComponent.getHeight() - insets.top - insets.bottom);
set ("allow_shrink", resizable);
set ("allow_grow", resizable);
}
native void setSize (int width, int height);
native void setBoundsCallback (Window window,
int x, int y,
int width, int height);
@ -159,7 +169,13 @@ public class GtkWindowPeer extends GtkContainerPeer
insets.bottom = bottom;
insets.right = right;
awtComponent.validate();
synchronized (latestInsets)
{
latestInsets.top = top;
latestInsets.left = left;
latestInsets.bottom = bottom;
latestInsets.right = right;
}
}
else
{
@ -178,15 +194,21 @@ public class GtkWindowPeer extends GtkContainerPeer
frame_y,
frame_width,
frame_height);
if (frame_width != awtComponent.getWidth()
|| frame_height != awtComponent.getHeight())
setSize (width, height);
awtComponent.validate();
}
}
awtComponent.validate();
}
native public void setVisible (boolean b);
native void nativeSetVisible (boolean b);
public void setVisible (boolean b)
{
// Prevent the window manager from automatically placing this
// window when it is shown.
if (b)
setBounds (awtComponent.getX(),
awtComponent.getY(),
awtComponent.getWidth(),
awtComponent.getHeight());
nativeSetVisible (b);
}
}