GtkDialogPeer.java (handleEvent): Remove method.
2003-10-24 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkDialogPeer.java (handleEvent): Remove method. * gnu/java/awt/peer/gtk/GtkWindowPeer.java (postWindowEvent): New method. * java/awt/Window.java (Window(Window,GraphicsConfiguration), show, hide, dispose, getOwnedWindows): Synchronize on tree lock. (dispose): Post WINDOW_CLOSED event. (addWindowFocusListener, addWindowStateListener): Assign result of multicaster add back to window listener. (removeWindowFocusListener, removeWindowStateListener): Assign result of multicaster remove back to window listener. (dispatchEventImpl): Add null checks for focus and state listeners. (processWindowEvent): Handle case where windowListener is null but state or focus listeners exist. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c: Add JNI glue for postWindowEvent. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (window_delete_cb, window_destroy_cb, window_show_cb, window_focus_in_cb, window_focus_out_cb, window_window_state_cb, window_get_new_state): New functions. * jni/gtk-peer/gtkpeer.h: Define window event and frame state macros. Declare postWindowEventID. From-SVN: r72906
This commit is contained in:
parent
6545596245
commit
f2d0e05d4e
7 changed files with 335 additions and 60 deletions
|
@ -80,13 +80,4 @@ public class GtkDialogPeer extends GtkWindowPeer
|
|||
args.add ("allow_shrink", dialog.isResizable ());
|
||||
args.add ("allow_grow", dialog.isResizable ());
|
||||
}
|
||||
|
||||
public void handleEvent (AWTEvent event)
|
||||
{
|
||||
// int id = event.getID();
|
||||
|
||||
// if (id == WindowEvent.WINDOW_CLOSING)
|
||||
// System.out.println ("got a closing event");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ import java.awt.Component;
|
|||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Window;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.peer.WindowPeer;
|
||||
|
||||
public class GtkWindowPeer extends GtkContainerPeer
|
||||
|
@ -56,6 +58,9 @@ 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;
|
||||
|
||||
private boolean hasBeenShown = false;
|
||||
private int oldState = Frame.NORMAL;
|
||||
|
||||
// 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
|
||||
|
@ -211,4 +216,29 @@ public class GtkWindowPeer extends GtkContainerPeer
|
|||
awtComponent.getHeight());
|
||||
nativeSetVisible (b);
|
||||
}
|
||||
|
||||
void postWindowEvent (int id, Window opposite, int newState)
|
||||
{
|
||||
if (id == WindowEvent.WINDOW_OPENED)
|
||||
{
|
||||
// Post a WINDOW_OPENED event the first time this window is shown.
|
||||
if (!hasBeenShown)
|
||||
{
|
||||
q.postEvent (new WindowEvent ((Window) awtComponent, id,
|
||||
opposite));
|
||||
hasBeenShown = true;
|
||||
}
|
||||
}
|
||||
else if (id == WindowEvent.WINDOW_STATE_CHANGED)
|
||||
{
|
||||
if (oldState != newState)
|
||||
{
|
||||
q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite,
|
||||
oldState, newState));
|
||||
oldState = newState;
|
||||
}
|
||||
}
|
||||
else
|
||||
q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue