Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2011-01-12 19:53:01 +0000
committerLakshmi Shanmugam2011-01-12 19:53:01 +0000
commitf6a24088b046b1954c66d99e5955f79165bd4145 (patch)
treed128b6b1c0cddfa02e688b95e3700b5a65a488cb /bundles/org.eclipse.swt/Eclipse SWT WebKit
parent1761843a9c19a7ae7292d52c4f6c51b7ff43f7d9 (diff)
downloadeclipse.platform.swt-f6a24088b046b1954c66d99e5955f79165bd4145.tar.gz
eclipse.platform.swt-f6a24088b046b1954c66d99e5955f79165bd4145.tar.xz
eclipse.platform.swt-f6a24088b046b1954c66d99e5955f79165bd4145.zip
webkit - fix mouse and key events
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT WebKit')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
index 75c7d1ae01..41f4b36567 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java
@@ -813,7 +813,7 @@ boolean handleEvent (Object[] arguments) {
case SWT.SCROLL_LOCK:
case SWT.COMMAND:
// case SWT.ESC:
-// case SWT.TAB:
+ case SWT.TAB:
case SWT.PAUSE:
// case SWT.BS:
case SWT.INSERT:
@@ -953,8 +953,7 @@ boolean handleEvent (Object[] arguments) {
int mask =
(((Boolean)arguments[5]).booleanValue () ? SWT.ALT : 0) |
(((Boolean)arguments[6]).booleanValue () ? SWT.CTRL : 0) |
- (((Boolean)arguments[7]).booleanValue () ? SWT.SHIFT : 0) |
- (((Boolean)arguments[8]).booleanValue () ? SWT.COMMAND : 0);
+ (((Boolean)arguments[7]).booleanValue () ? SWT.SHIFT : 0);
mouseEvent.stateMask = mask;
if (type.equals (DOMEVENT_MOUSEDOWN)) {
@@ -981,6 +980,13 @@ boolean handleEvent (Object[] arguments) {
mouseEvent.type = SWT.MouseUp;
mouseEvent.count = ((Double)arguments[3]).intValue ();
mouseEvent.button = ((Double)arguments[4]).intValue ();
+ switch (mouseEvent.button) {
+ case 1: mouseEvent.stateMask |= SWT.BUTTON1; break;
+ case 2: mouseEvent.stateMask |= SWT.BUTTON2; break;
+ case 3: mouseEvent.stateMask |= SWT.BUTTON3; break;
+ case 4: mouseEvent.stateMask |= SWT.BUTTON4; break;
+ case 5: mouseEvent.stateMask |= SWT.BUTTON5; break;
+ }
} else if (type.equals (DOMEVENT_MOUSEMOVE)) {
mouseEvent.type = SWT.MouseMove;
} else if (type.equals (DOMEVENT_MOUSEWHEEL)) {
@@ -990,6 +996,8 @@ boolean handleEvent (Object[] arguments) {
mouseEvent.type = SWT.MouseEnter;
} else if (type.equals (DOMEVENT_MOUSEOUT)) {
mouseEvent.type = SWT.MouseExit;
+ if (mouseEvent.x < 0) mouseEvent.x = -1;
+ if (mouseEvent.y < 0) mouseEvent.y = -1;
} else if (type.equals (DOMEVENT_DRAGSTART)) {
mouseEvent.type = SWT.DragDetect;
mouseEvent.button = ((Double)arguments[4]).intValue () + 1;
@@ -1099,6 +1107,12 @@ public void refresh () {
}
boolean sendKeyEvent (Event event) {
+ /*
+ * browser.traverse() is called through dislay.translateTraversal() for all
+ * traversal types except SWT.TRAVERSE_MNEMONIC. So, override
+ * WebBrowser.sendKeyEvent() so that when it is called from handleEvent(),
+ * browser.traverse() is not called again.
+ */
boolean doit = true;
switch (event.keyCode) {
case SWT.ESC:
@@ -1110,7 +1124,6 @@ boolean sendKeyEvent (Event event) {
case SWT.TAB:
case SWT.PAGE_DOWN:
case SWT.PAGE_UP:
- doit = false;
break;
default: {
if (translateMnemonics ()) {

Back to the top