Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2016-03-02 05:02:26 -0500
committerGerrit Code Review @ Eclipse.org2016-03-11 14:16:54 -0500
commita710d14d7232281e8f3a725604b3ac8fd9b44cb9 (patch)
treee0b2195a330fc597c2730d88c47a53be5072a933 /bundles
parentb487f1df9f3bf72eed6b3996c39217cd8560bff2 (diff)
downloadorg.eclipse.rap-a710d14d7232281e8f3a725604b3ac8fd9b44cb9.tar.gz
org.eclipse.rap-a710d14d7232281e8f3a725604b3ac8fd9b44cb9.tar.xz
org.eclipse.rap-a710d14d7232281e8f3a725604b3ac8fd9b44cb9.zip
Fix missing mouse up event outside control
The idea of ControlOperationHandler#allowMouseEvent is to suppress mouse events witch are not fired in SWT - mouse event on control border, Table/Tree header or Shell title/menu bars. In SWT is possible to have a mouse up event with negative to the Control x and y (described in bug 488755 description). The implementation of ControlOperationHandler#allowMouseEvent must suppress by default only mouse events on Control border. 488755: Missing Event type MouseUp https://bugs.eclipse.org/bugs/show_bug.cgi?id=488755 Change-Id: I9c6bf41f81c824c6718a5f5e5910f9a1effbe412
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/protocol/ControlOperationHandler.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/protocol/ControlOperationHandler.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/protocol/ControlOperationHandler.java
index 29d91d1ae5..362264b77d 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/protocol/ControlOperationHandler.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/protocol/ControlOperationHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2015 EclipseSource and others.
+ * Copyright (c) 2013, 2016 EclipseSource 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
@@ -38,6 +38,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
@@ -337,9 +338,12 @@ public abstract class ControlOperationHandler<T extends Control> extends WidgetO
return event;
}
- @SuppressWarnings( "unused" )
protected boolean allowMouseEvent( T control, int x, int y ) {
- return x >= 0 && y >= 0;
+ Point size = control.getSize();
+ int borderWidth = control.getBorderWidth();
+ Rectangle outerBounds = new Rectangle( - borderWidth, - borderWidth, size.x, size.y );
+ Rectangle innerBounds = new Rectangle( 0, 0, size.x - 2 * borderWidth, size.y - 2 * borderWidth );
+ return !outerBounds.contains( x, y ) || innerBounds.contains( x, y );
}
private static int determineCount( int eventType, Control control ) {

Back to the top