[Ptolemy] Re: [kepler-dev] Re: right click bug with linux and OSX

Christopher Hylands Brooks cxh at eecs.berkeley.edu
Thu Jul 15 10:35:41 PDT 2004


Below is the mail from June 7 that surrounds this issue
http://chess.eecs.berkeley.edu/ptolemy/listinfo/ptolemy/2004-June/007419.html
says:

[Steve writes]

>OK, I think I see what the difficulty is here.  The problem is that
>drag and drop apparently resets the keyboard focus.  Before my Mac
>changes, mouse events were always passed to the base class, which
>would result in the keyboard focus getting set properly.  However, on
>the Mac, setting the keyboard focus also clears the context menu, so
>I modified the diva base classes to only pass the event to the base
>class if it was not marked as consumed (for example, selecting a
>figure consumes the event).  However, now this prevents selections
>from getting around to setting the mouse focus.

>I've now backed out some of my MAc fixes and tried a different way of
>implementing that will hopefully work, by putting the code that gets
>the keyboard focus earlier in the event processing before the context
>menus... This should still work for Mac.

>Dan or Chad: Can you verify that the Mac side still works?
>particularly context menus and keyboard shortcuts immediately after
>dropping an actor.

>I hate debugging without test suites.
>
>Steve
>
>At 09:09 AM 6/7/2004, you wrote:
>
>>We have a serious new bug with the UI.
>>
>>When I place a Sinewave actor into an empty model,
>>select it, hit control-C (or Edit-->Copy), and then paste,
>>nothing is pasted.  If I paste into a text window, what
>>is pasted is the result of toString() on the Sinewave actor.
>>The debugger tells me that, in fact,
>>BasicGraphFrame.CopyAction.actionPerformed() is not
>>called, so the bug is before this in the event handling chain.
>>Perhaps the changes to diva to support the MAC caused this?
>>
>>Strangely, after I paste into a text editor, then
>>I can copy and paste normally, and everything works.
>>Until I drag in a new Sinewave actor...
>>
>>Edward

I was not able to replicate this bug when I ran with the 1.11 version
of JCanvas.java in the ptII Devel head.

Following Edward's steps:
>>When I place a Sinewave actor into an empty model,
>>select it, hit control-C (or Edit-->Copy), and then paste,
>>nothing is pasted.
Not for me, I get a new actor
>> If I paste into a text window, what
>>is pasted is the result of toString() on the Sinewave actor.
I get the MoML of the actor?

<entity name="Sinewave" class="ptolemy.actor.lib.Sinewave">
    <property name="_location" class="ptolemy.kernel.util.Location"
    value="{140, 165}">
    </property>
    <port name="frequency"
    class="ptolemy.actor.parameters.ParameterPort">
        <property name="input"/>
        <property name="_location"
    class="ptolemy.kernel.util.Location" value="{10.0, 85.0}">
        </property>
    </port>
    <port name="phase" class="ptolemy.actor.parameters.ParameterPort">
        <property name="input"/>
        <property name="_location"
    class="ptolemy.kernel.util.Location" value="{10.0, 125.0}">
        </property>
    </port>
</entity>

I think the thing to do is roll back to 1.11 of JCanvas, recreate
diva.jar and see what happens.

-Christopher

--------

    Well, it looks like the problem with the mac is the following
    change to diva/canvas/JCanvas.java:
    
    2004-06-07 14:43  neuendor
    
    	* diva/canvas/JCanvas.java (1.12): rollback previous change.  PC
    	keyboard shortcuts with FocusMouseListener didn't work anymore. 
    	Reimplemented focusMouseListener with a LayerListener attached to
    	the ForegroundEventLayer instead of a MouseListener
    
    
    The diff is:
    cxh at maury 101% cvs diff -r 1.11 -r 1.12 JCanvas.java
    Index: JCanvas.java
    ===================================================================
    RCS file: /home/cvs/ptII/diva/canvas/JCanvas.java,v
    retrieving revision 1.11
    retrieving revision 1.12
    diff -r1.11 -r1.12
    65c65
    <  * @version        $Id: JCanvas.java,v 1.11 2004/05/19 00:20:59 neuendor 
   Exp $
    ---
    >  * @version        $Id: JCanvas.java,v 1.12 2004/06/07 21:43:30 neuendor 
   Exp $
    338,340c338,342
    <      * event on to its pane (if it is not null).
    <      * The mouse event is passed to the superclass' method for
    <      * handling.
    ---
    >      * event on to its pane (if it is not null).  The mouse event is
    >      * passed to the superclass' method for handling.  Note that the
    >      * event is always passed on to the base class event processing
    >      * (i.e. MouseListeners added to the canvas) regardless of whether
    >      * or not the event was consumed.
    344,348c346
    <         // The below call *should* be extranneous, but at least on the
    <         // Macintosh, it prevents popup menus from being created...
    <         if(!e.isConsumed()) {
    <             super.processMouseEvent(e);
    <         }
    ---
    >         super.processMouseEvent(e);
    352,355c350,355
    <      * inherited method to create a LayerEvent or LayerMotionEvent
    <      * and pass the event on to its pane (if it is not null).
    <      * The mouse event is passed to the superclass' method for
    <      * handling.
    ---
    >      * inherited method to create a LayerEvent or LayerMotionEvent and
    >      * pass the event on to its pane (if it is not null).  The mouse
    >      * event is passed to the superclass method for handling.  Note
    >      * that the event is always passed on to the base class event
    >      * processing (i.e. MouseListeners added to the canvas) regardless
    >      * of whether or not the event was consumed.
    359,363c359
    <         // The below call *should* be extranneous, but at least on the
    <         // Macintosh, it is probably necessary (see above).
    <         if(!e.isConsumed()) {
    <             super.processMouseMotionEvent(e);
    <         }
    ---
    >         super.processMouseMotionEvent(e);
    
    I think a fix like this is necessary because without it, we won't
    get PC Keyboard shortcuts.  I'll verify this shortly under Windows.
    
    BTW - I had to use Eclipse-3.0 to check out branches by date on the
    Mac.  However, I could not for the life of me figure out how to 
    _build_ on the Mac under Eclipse-3.0, so I checked out the branch
    by date with Eclipse-3.0 and then use Eclipse-2.1 to build.  
    I must be doing something silly.
    
    I'm using Tansy's Mac, which I might be able to use later today
    to verify fixes.
    
    -Christopher
    
    --------
    
        On Wed, 14 Jul 2004, Christopher Hylands Brooks wrote:
        
        >     I did try jdk1.5 and the problem was fixed.  I'll try to cvs head
    tod
       ay.
        
        I rebuilt with jdk 1.5 as well, and it does fix the problem.  Actually 
   the
        'look and feel' of the GUI changes a bit with jdk 1.5.  Might just be t
   he
        fonts.
        
        Tobin
        
        _______________________________________________
        kepler-dev mailing list
        kepler-dev at ecoinformatics.org
        http://www.ecoinformatics.org/mailman/listinfo/kepler-dev
    --------
    _______________________________________________
    Ptolemy maillist  -  Ptolemy at chess.eecs.berkeley.edu
    http://chess.eecs.berkeley.edu/ptolemy/listinfo/ptolemy
--------



More information about the Kepler-dev mailing list