/[libvob]/libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java
ViewVC logotype

Diff of /libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by tjl, Sat Aug 9 14:39:45 2003 UTC revision 1.9 by mudyc, Thu Sep 11 15:32:09 2003 UTC
# Line 163  public class MouseMultiplexer { Line 163  public class MouseMultiplexer {
163          currentDrag = null;          currentDrag = null;
164      }      }
165    
166        /** Whether a drag from a mouse press and a
167         * subsequent mouse motion event has been started.
168         * It is extremely not allowed to call the
169         * endDrag() method if there were no drag events,
170         * otherwise clicked and endDrag methods
171         * are probably both called.
172         */
173        private boolean dragStarted = false;
174    
175      /** Send an event to the correct listener.      /** Send an event to the correct listener.
176       * @return true if the event was used by this multiplexer.       * @return true if the event was used by this multiplexer.
# Line 175  public class MouseMultiplexer { Line 183  public class MouseMultiplexer {
183              if(mpl == null) return false;              if(mpl == null) return false;
184              currentDrag = mpl.pressed(e.getX(), e.getY());              currentDrag = mpl.pressed(e.getX(), e.getY());
185              if(currentDrag != null) {              if(currentDrag != null) {
186                    dragStarted = false;
187                  currentDragButton = e.getButton();                  currentDragButton = e.getButton();
188                  currentDrag.startDrag(e.getX(), e.getY());                  currentDrag.startDrag(e.getX(), e.getY());
189                  return true;                  return true;
190              }              }
191          } else if(e.getType() == e.MOUSE_DRAGGED) {          } else if(e.getType() == e.MOUSE_DRAGGED) {
192              if(currentDrag != null) {              if(currentDrag != null) {
193                    dragStarted = true;
194                  currentDrag.drag(e.getX(), e.getY());                  currentDrag.drag(e.getX(), e.getY());
195                  return true;                  return true;
196              }              }
# Line 188  public class MouseMultiplexer { Line 198  public class MouseMultiplexer {
198              if(currentDragButton != 0 &&              if(currentDragButton != 0 &&
199                 e.getButton() == currentDragButton) {                 e.getButton() == currentDragButton) {
200                  currentDragButton = 0;                  currentDragButton = 0;
201                  currentDrag.endDrag(e.getX(), e.getY());                  if (dragStarted)
202                        currentDrag.endDrag(e.getX(), e.getY());
203                  currentDrag = null;                  currentDrag = null;
204                  return true;                  return true;
205              }              }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26