summaryrefslogtreecommitdiffstats
path: root/bundles
diff options
context:
space:
mode:
authorGrant Gayed <grant_gayed@ca.ibm.com>2012-04-05 09:53:11 -0400
committerGrant Gayed <grant_gayed@ca.ibm.com>2012-04-05 09:53:11 -0400
commit258448430288a4f79a83683cae42bc4aa811db5c (patch)
tree387fb1e330904b44441b5e59edc75890a0477f88 /bundles
parent0cb48e6dc6d4cd7842728d49aab01617b288dc45 (diff)
downloadeclipse.platform.swt-258448430288a4f79a83683cae42bc4aa811db5c.tar.gz
eclipse.platform.swt-258448430288a4f79a83683cae42bc4aa811db5c.tar.xz
eclipse.platform.swt-258448430288a4f79a83683cae42bc4aa811db5c.zip
Bug 376183 - [Browser] tabbing does not work in XULRunner 10
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
index e32a072b98..3d2ef95ce1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/win32/org/eclipse/swt/browser/MozillaDelegate.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.internal.Callback;
import org.eclipse.swt.internal.mozilla.*;
@@ -141,6 +142,41 @@ boolean hookEnterExit () {
}
void init () {
+ if (!Mozilla.IsPre_4) {
+ /*
+ * In XULRunner versions > 4, sending WM_GETDLGCODE to a WM_KEYDOWN's MSG hwnd answers 0
+ * instead of the expected DLGC_WANTTAB or DLGC_WANTALLKEYS. As a result, Tab presses
+ * always default to traversals out of the browser. The workaround for this is to add a
+ * Traverse listener that vetos any tab traversals that are attempted while an element
+ * in the browser has focus.
+ */
+ browser.addListener (SWT.Traverse, new Listener () {
+ public void handleEvent (Event event) {
+ if ((event.detail & (SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS)) == 0) return;
+
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FOCUSMANAGER_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIFocusManager.NS_IFOCUSMANAGER_10_IID, result);
+ serviceManager.Release ();
+
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ nsIFocusManager focusManager = new nsIFocusManager (result[0]);
+ result[0] = 0;
+ rc = focusManager.GetFocusedElement (result);
+ focusManager.Release ();
+ event.doit = result[0] == 0;
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ new nsISupports (result[0]).Release ();
+ }
+ }
+ }
+ });
+ }
}
void onDispose (int /*long*/ embedHandle) {