Bug 240806 - Inconsistency in EventHandling (MenuDetectListener)
Summary: Inconsistency in EventHandling (MenuDetectListener)
Status: CLOSED DUPLICATE of bug 79925
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-15 07:30 EDT by Kristian Sons CLA
Modified: 2009-12-07 09:20 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kristian Sons CLA 2008-07-15 07:30:08 EDT
Hello,

I have git an inconsitency between SWT-Win32 and SWT-Linux-GTK. I attached a MouseListener and a MenuDetectListener. If I have a Mouse button 3 event, on Windows first the MouseDown Event is fired than the menuDetected event, on linux-gtk it is the other way around. I think the windows behaviour is the expected behaviour because i.e. one can prevent the context menu when a mouse drag is detected.

Code for reproduction:

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Shell");
    shell.setSize(200, 200);
    shell.setLayout(new GridLayout());
    Canvas canvas = new Canvas(shell, SWT.NONE);
    canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    canvas.addMenuDetectListener(new MenuDetectListener() {

		public void menuDetected(MenuDetectEvent e) {
			System.out.println("MenuDetectedEvent");
			System.out.println("Pos: X:" + e.x + " Y "+ e.y);
			
		}});
    
    canvas.addMouseListener(new MouseListener() {

		public void mouseDoubleClick(MouseEvent e) {
			// TODO Auto-generated method stub
			
		}

		public void mouseDown(MouseEvent e) {
			if (e.button == 3)
			{
				System.out.println("Mouse button 3 down");
				System.out.println("Pos: X:" + e.x + " Y "+ e.y);
			}
		}

		public void mouseUp(MouseEvent e) {
			if (e.button == 3)
				System.out.println("Mouse button 3 up");
			
		}});
   
    	
    
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}
Comment 1 Praveen CLA 2009-12-07 03:01:06 EST
This is a duplicate of bug#79925.
Comment 2 Bogdan Gheorghe CLA 2009-12-07 09:20:26 EST
Thanks Praveen - closing as a DUPLICATE.

*** This bug has been marked as a duplicate of bug 79925 ***