summaryrefslogtreecommitdiffstats
path: root/bundles
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe>2008-07-24 19:08:15 +0000
committerBogdan Gheorghe <gheorghe>2008-07-24 19:08:15 +0000
commit09003b1fffae58f15eda69b4fc119515f5f52f28 (patch)
tree12d8d31279367b9b245347158bfeae8314b1a1d7 /bundles
parentdcad198911b94c2b342ed75a902cdf519678fee7 (diff)
downloadeclipse.platform.swt-09003b1fffae58f15eda69b4fc119515f5f52f28.tar.gz
eclipse.platform.swt-09003b1fffae58f15eda69b4fc119515f5f52f28.tar.xz
eclipse.platform.swt-09003b1fffae58f15eda69b4fc119515f5f52f28.zip
173218 [SWT_AWT] SWT needs to support ModalityListener interface
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
index df261568f3..24fcdd5496 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
@@ -26,10 +26,13 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Event;
/* AWT Imports */
+import java.awt.AWTEvent;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Canvas;
import java.awt.Frame;
+import java.awt.Window;
+import java.awt.event.AWTEventListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.WindowEvent;
@@ -60,7 +63,7 @@ public class SWT_AWT {
static boolean loaded, swingInitialized;
-static native final int /*long*/ getAWTHandle (Canvas canvas);
+static native final int /*long*/ getAWTHandle (Object canvas);
static native final void setDebug (Frame canvas, boolean debug);
static synchronized void loadLibrary () {
@@ -186,6 +189,27 @@ public static Frame new_Frame (final Composite parent) {
Method method = clazz.getMethod("registerListeners", null);
if (method != null) method.invoke(value, null);
} catch (Throwable e) {}
+ final AWTEventListener awtListener = new AWTEventListener() {
+ public void eventDispatched(AWTEvent event) {
+ if (event.getID() == WindowEvent.WINDOW_OPENED) {
+ final Window window = (Window) event.getSource();
+ if (window.getParent() == frame) {
+ parent.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (parent.isDisposed()) return;
+ Shell shell = parent.getShell();
+ loadLibrary();
+ int /*long*/ awtHandle = getAWTHandle(window);
+ if (awtHandle == 0) return;
+ int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid(OS.GTK_WIDGET_WINDOW(OS.gtk_widget_get_toplevel(shell.handle)));
+ OS.XSetTransientForHint(OS.GDK_DISPLAY(), awtHandle, xWindow);
+ }
+ });
+ }
+ }
+ }
+ };
+ frame.getToolkit().addAWTEventListener(awtListener, AWTEvent.WINDOW_EVENT_MASK);
final Listener shellListener = new Listener () {
public void handleEvent (Event e) {
switch (e.type) {
@@ -220,6 +244,7 @@ public static Frame new_Frame (final Composite parent) {
parent.setVisible(false);
EventQueue.invokeLater(new Runnable () {
public void run () {
+ frame.getToolkit().removeAWTEventListener(awtListener);
frame.dispose ();
}
});