summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe>2008-08-26 20:38:57 +0000
committerBogdan Gheorghe <gheorghe>2008-08-26 20:38:57 +0000
commit3d1253cbd7eb819e01f7e0bed0c2edeb578c461c (patch)
tree3ff37a1d68b83328226cbe6958cbbfe4719a5077
parent9309510417c504bcafbd967087551fc387739261 (diff)
downloadeclipse.platform.swt-3d1253cbd7eb819e01f7e0bed0c2edeb578c461c.tar.gz
eclipse.platform.swt-3d1253cbd7eb819e01f7e0bed0c2edeb578c461c.tar.xz
eclipse.platform.swt-3d1253cbd7eb819e01f7e0bed0c2edeb578c461c.zip
173218 [SWT_AWT] SWT needs to support ModalityListener interface
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT AWT/motif/org/eclipse/swt/awt/SWT_AWT.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java9
8 files changed, 65 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties
index 026dddc345..b28683a47a 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
+# Copyright (c) 2000, 2008 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -804,6 +804,11 @@ OS__XSetTile_0=cast=Display *
OS__XSetTile_1=cast=GC
OS__XSetTile_2=cast=Pixmap
+OS__XSetTransientForHint=
+OS__XSetTransientForHint_0=cast=(Display *)
+OS__XSetTransientForHint_1=cast=(Window)
+OS__XSetTransientForHint_2=cast=(Window)
+
OS__XSetWMNormalHints=
OS__XSetWMNormalHints_0=cast=Display *
OS__XSetWMNormalHints_1=cast=(Window)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/motif/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/motif/org/eclipse/swt/awt/SWT_AWT.java
index 18e45a7059..77421fc209 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/motif/org/eclipse/swt/awt/SWT_AWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/motif/org/eclipse/swt/awt/SWT_AWT.java
@@ -16,6 +16,7 @@ import java.lang.reflect.Method;
/* SWT Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.motif.OS;
import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Shell;
@@ -25,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;
@@ -59,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 () {
@@ -175,6 +179,29 @@ 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() {
+ Shell shell = parent.getShell();
+ loadLibrary();
+ int awtHandle = getAWTHandle(window);
+ if (awtHandle == 0) return;
+ int xtParent = OS.XtParent (shell.handle);
+ while (xtParent != 0 && !OS.XtIsSubclass (xtParent, OS.shellWidgetClass ())) {
+ xtParent = OS.XtParent (xtParent);
+ }
+ OS.XSetTransientForHint(OS.XtDisplay(xtParent), awtHandle, OS.XtWindow(xtParent));
+ }
+ });
+ }
+ }
+ }
+ };
+ frame.getToolkit().addAWTEventListener(awtListener, AWTEvent.WINDOW_EVENT_MASK);
final Listener shellListener = new Listener () {
public void handleEvent (Event e) {
switch (e.type) {
@@ -209,6 +236,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 ();
}
});
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c
index 93ca4dba61..5ba381e12c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -2020,6 +2020,18 @@ JNIEXPORT void JNICALL OS_NATIVE(_1XSetTile)
}
#endif
+#ifndef NO__1XSetTransientForHint
+JNIEXPORT jint JNICALL OS_NATIVE(_1XSetTransientForHint)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1XSetTransientForHint_FUNC);
+ rc = (jint)XSetTransientForHint((Display *)arg0, (Window)arg1, (Window)arg2);
+ OS_NATIVE_EXIT(env, that, _1XSetTransientForHint_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1XSetWMNormalHints
JNIEXPORT void JNICALL OS_NATIVE(_1XSetWMNormalHints)
(JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c
index 42f9165484..f7022ddc1d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 465;
-int OS_nativeFunctionCallCount[465];
+int OS_nativeFunctionCount = 466;
+int OS_nativeFunctionCallCount[466];
char * OS_nativeFunctionNames[] = {
"CODESET",
"FD_1ISSET",
@@ -160,6 +160,7 @@ char * OS_nativeFunctionNames[] = {
"_1XSetSubwindowMode",
"_1XSetTSOrigin",
"_1XSetTile",
+ "_1XSetTransientForHint",
"_1XSetWMNormalHints",
"_1XSetWindowBackgroundPixmap",
"_1XShapeCombineMask",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h
index 64954e11bc..251ed945a6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -168,6 +168,7 @@ typedef enum {
_1XSetSubwindowMode_FUNC,
_1XSetTSOrigin_FUNC,
_1XSetTile_FUNC,
+ _1XSetTransientForHint_FUNC,
_1XSetWMNormalHints_FUNC,
_1XSetWindowBackgroundPixmap_FUNC,
_1XShapeCombineMask_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.c
index 96a1999e9b..e3544f692b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.h
index 72e7c60157..eaf6fcd650 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_structs.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
index 7dad61d413..a460711bc4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
@@ -1937,6 +1937,15 @@ public static final void XSetTile(int display, int gc, int pixmap) {
lock.unlock();
}
}
+public static final native int _XSetTransientForHint(int display, int w, int prop_window);
+public static final int XSetTransientForHint(int display, int w, int prop_window) {
+ lock.lock();
+ try {
+ return _XSetTransientForHint(display, w, prop_window);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native void _XSetTSOrigin(int display, int gc, int ts_x_origin, int ts_y_origin);
public static final void XSetTSOrigin(int display, int gc, int ts_x_origin, int ts_y_origin) {
lock.lock();