Community
Participate
Working Groups
To reproduce it with the Control Demo -> ButtonTab add mouse listener to the push button: ---- line 77 ---- pushButton.addMouseListener( new MouseAdapter() { public void mouseDown( final MouseEvent e ) { log( "SWT.MouseDown event: " + e ); } public void mouseUp( final MouseEvent e ) { log( "SWT.MouseUp event: " + e ); } } ); ---------- Try to click on the top left corner of the push button. The MouseEvent (x, y) are (2, 2) instead of (0, 0). This is related to number of parents border that are set. In the current example we have 1px border of the shell and 1px border of the CTabFolder. And the mouse coordinates are shifted with 2 pixels. In more complex layouts (more parents borders set), this offset become significant.
Created attachment 128809 [details] Proposed patch This patch do the folowing: 1. Display#map - add border width to bounds.x and bounds.y for both from and to controls. 2. Fix the JUnit tests and added a new one in Display_Test. Now all the tests related to Display#map method are tested and running succefully both in RAP and SWT. 3. Fix the MouseEvent tests when the mouse coordinates are checked. Add a new one for testing that no mouse event is fired when you click on the control border. 4. In ControlLCAUtil#processMouseEvents prevent fireing of mouse event if the coordinates after the mapping are negative (we have a negative coordinates when you click on the border). In SWT the MouseEvents are not fired when you click on the border too.
Created attachment 130072 [details] Updated patch. In addition the shell mouse events are fixed - only client area process mouse events. The shell mouse event with x,y (0,0) is the client area (0,0).
Created attachment 130963 [details] Updated patch. Display#map now checks for Scrollable and substract the trimming too.
Fixed in CVS HEAD.
We found some side effects in the workbench. Changes are reverted.
Maybe bug 232967(PerspectiveSwitcher's dropdown menu is misaligned) depends on this issue. Ivan, could you have a look, once this bug is resolved?
Two problems related to CTabFolder are fixed: 1. CTabFolder#getBorderWidth() always returns 0 despite of SWT.BORDER style flag (same in SWT). 2. CTabFolder tabs area is "active" - process mouse events. It is possible to map a point from/to "tabs" area.
(In reply to comment #6) > Maybe bug 232967(PerspectiveSwitcher's dropdown menu is misaligned) depends on > this issue. Ivan, could you have a look, once this bug is resolved? No... bug 232967 does not depend on this issue.