Page 1 of 1

BUG: Insight 4.3.2 - No context menu on Unix

PostPosted: Fri Sep 23, 2011 10:09 am
by a.herbert
Hi,

I have just upgraded to OMERO 4.3.2 and have lost the right-click context menu from Insight on my Linux client. A quick check of our Windows and Mac versions show that the menu is still available.

Any ideas of how this has changed in the recent build? I can easily patch all our clients if you can identify a fix.

Alex

Re: BUG: Insight 4.3.2 - No context menu on Unix

PostPosted: Tue Sep 27, 2011 11:35 am
by a.herbert
Hi,

I have tracked this problem down to a change in the code for:

insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/browser/BrowserUI.java
private void createTrees(ExperimenterData exp)

In version 4.3.0 the mouse listeners for the treeDisplay would always call the onClick() event for both mousePressed() and mouseReleased(). In version 4.3.2 there is now code to call onClick() on the mouse pressed event if the machine is a Mac, otherwise call the onClick() event in the mouse released event.

However the code within onClick() tests for the mouseEvent.isPopupTrigger() result to determine whether to show the pop-up menu. Unfortunately on a Linux system the isPopupTrigger() returns true for mousePressed() and false for mouseReleased(). This means that onClick() should be called in the same place as the Mac variant. So:

Code: Select all
        treeDisplay.addMouseListener(new MouseAdapter() {
           public void mousePressed(MouseEvent e)
           {
              rightClickPad = UIUtilities.isMacOS() &&
            SwingUtilities.isLeftMouseButton(e) && e.isControlDown();
              rightClickButton = SwingUtilities.isRightMouseButton(e);
              ctrl = e.isControlDown();
              if (UIUtilities.isMacOS()) ctrl = e.isMetaDown();
              leftMouseButton = SwingUtilities.isLeftMouseButton(e);
              if (UIUtilities.isMacOS() || UIUtilities.isLinuxOS()) onClick(e, false);
           }
           public void mouseReleased(MouseEvent e)
           {
              leftMouseButton = SwingUtilities.isLeftMouseButton(e);
              if (!(UIUtilities.isMacOS() || UIUtilities.isLinuxOS())) onClick(e, true);
           }


An alternative may be:

Code: Select all
        treeDisplay.addMouseListener(new MouseAdapter() {
           public void mousePressed(MouseEvent e)
           {
              rightClickPad = UIUtilities.isMacOS() &&
            SwingUtilities.isLeftMouseButton(e) && e.isControlDown();
              rightClickButton = SwingUtilities.isRightMouseButton(e);
              ctrl = e.isControlDown();
              if (UIUtilities.isMacOS()) ctrl = e.isMetaDown();
              leftMouseButton = SwingUtilities.isLeftMouseButton(e);
              if (e.isPopupTrigger()) onClick(e, false);
           }
           public void mouseReleased(MouseEvent e)
           {
              leftMouseButton = SwingUtilities.isLeftMouseButton(e);
              if (e.isPopupTrigger()) onClick(e, true);
           }


The first version would perform as expected on a Mac and Windows system, it just changes the Linux behaviour. However I have not tested the second variant on all platforms so cannot be sure that on Mac/Windows it will be OK.

Alex

Re: BUG: Insight 4.3.2 - No context menu on Unix

PostPosted: Tue Sep 27, 2011 11:57 am
by jburel
Hi Alex

Thanks for pointing that out.
I have created a ticket http://trac.openmicroscopy.org.uk/ome/ticket/6864.

I will get that sorted for 4.3.3.

Thanks
Jmarie

Re: BUG: Insight 4.3.2 - No context menu on Unix

PostPosted: Tue Sep 27, 2011 1:34 pm
by a.herbert
Here is another place that I have found where the same fix is needed:

org.openmicroscopy.shoola.agents.dataBrowser.browser.BrowserControl
mousePressed() + mouseReleased()

A search within the code for isPopupTrigger() did not find any other places where the code appears to be broken on Linux.

Regards,

Alex

Re: BUG: Insight 4.3.2 - No context menu on Unix

PostPosted: Wed Oct 12, 2011 5:01 pm
by jburel
Hi

I forgot to mention in my previous post: we did not use the isPopuptrigger() b/c I noticed some issues while selecting via the trackpad

Jmarie