Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362635

Summary: SWT.MenuDetect event is not fired in Safari
Product: [RT] RAP Reporter: Yury <swimmer_86>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.4   
Target Milestone: 1.5 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Yury CLA 2011-11-02 03:48:15 EDT
Build Identifier: RAP 1.4

Snippet to reproduce:

  public int createUI() {

    Display display = PlatformUI.createDisplay();
    
    Shell shell = new Shell(display);
    shell.setLayout( new GridLayout() );
    
    Menu menu = new Menu(shell, SWT.POP_UP);
    MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
    menuItem.setText("Action");
    menuItem.addSelectionListener(new SelectionAdapter()
        {
            public void widgetSelected(SelectionEvent se)
            {
                System.out.println("Action!");
            }
        });
    shell.addListener(SWT.MenuDetect, new Listener()
        {
            public void handleEvent(Event event)
            {
                System.out.println("Menu detect");
            }
        });
    shell.setMenu(menu);
    
    shell.open();
    
    while( !shell.isDisposed() ) {
      try {
        if( !display.readAndDispatch() ) {
          display.sleep();
        }
      } catch( Throwable t ) {
        break;
      }
    }
    display.dispose();
    return 0;
  }

It works fine in IE, FF, Chrome, but does not work in Safari 5.1.1.

Reproducible: Always

Steps to Reproduce:
1. Run the snippet.
2. Right click to open popup menu.
3. Select the menu item.

Selection event is fired, but menudetect even - does not.
Comment 1 Ivan Furnadjiev CLA 2011-11-02 05:19:22 EDT
I can confirm that too - no MenuDetect event on Sfari 5.1.1. All other browsers work fine.
Comment 2 Ivan Furnadjiev CLA 2011-11-02 05:47:41 EDT
My tests show that sometimes we have "mouse detect" event, but most often we haven't. Somehow this is related to the context menu set. If I remove the menu (comment the line shell.setMenu(menu);) MenuDetect event works fine all the time. My observations are that EventUtil.js#menuDetectedByMouse is not called at all.
Comment 3 Ivan Furnadjiev CLA 2011-11-02 11:15:52 EDT
This bug has been fixed with the fix for Bug 362243.