src/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page




 786             }
 787 
 788             notifyUpdateCursor();
 789         }
 790     }
 791 
 792     public void dispatchMouseWheelEvent(long when, int x, int y, int modifiers,
 793                                         int scrollType, int scrollAmount,
 794                                         int wheelRotation, double preciseWheelRotation,
 795                                         byte[] bdata)
 796     {
 797         // TODO: could we just use the last mouse event target here?
 798         Rectangle r = getBounds();
 799         // findPeerAt() expects parent coordinates
 800         final LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y);
 801         if (targetPeer == null || !targetPeer.isEnabled()) {
 802             return;
 803         }
 804 
 805         Point lp = targetPeer.windowToLocal(x, y, this);




 806         // TODO: fill "bdata" member of AWTEvent
 807         // TODO: screenX/screenY
 808         postEvent(new MouseWheelEvent(targetPeer.getTarget(),
 809                                       MouseEvent.MOUSE_WHEEL,
 810                                       when, modifiers,
 811                                       lp.x, lp.y,
 812                                       0, 0, /* screenX, Y */
 813                                       0 /* clickCount */, false /* popupTrigger */,
 814                                       scrollType, scrollAmount,
 815                                       wheelRotation, preciseWheelRotation));
 816     }
 817 
 818     /*
 819      * Called by the delegate when a key is pressed.
 820      */
 821     public void dispatchKeyEvent(int id, long when, int modifiers,
 822                                  int keyCode, char keyChar, int keyLocation)
 823     {
 824         LWComponentPeer focusOwner =
 825             LWKeyboardFocusManagerPeer.getInstance(getAppContext()).




 786             }
 787 
 788             notifyUpdateCursor();
 789         }
 790     }
 791 
 792     public void dispatchMouseWheelEvent(long when, int x, int y, int modifiers,
 793                                         int scrollType, int scrollAmount,
 794                                         int wheelRotation, double preciseWheelRotation,
 795                                         byte[] bdata)
 796     {
 797         // TODO: could we just use the last mouse event target here?
 798         Rectangle r = getBounds();
 799         // findPeerAt() expects parent coordinates
 800         final LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y);
 801         if (targetPeer == null || !targetPeer.isEnabled()) {
 802             return;
 803         }
 804 
 805         Point lp = targetPeer.windowToLocal(x, y, this);
 806         int signum = (int) Math.signum(preciseWheelRotation);
 807         if (wheelRotation == 0 && signum * wheelRotation < 1) {
 808            wheelRotation = signum;
 809         }
 810         // TODO: fill "bdata" member of AWTEvent
 811         // TODO: screenX/screenY
 812         postEvent(new MouseWheelEvent(targetPeer.getTarget(),
 813                 MouseEvent.MOUSE_WHEEL,
 814                 when, modifiers,
 815                 lp.x, lp.y,
 816                 0, 0, /* screenX, Y */
 817                 0 /* clickCount */, false /* popupTrigger */,
 818                 scrollType, scrollAmount,
 819                 wheelRotation, preciseWheelRotation));
 820     }
 821 
 822     /*
 823      * Called by the delegate when a key is pressed.
 824      */
 825     public void dispatchKeyEvent(int id, long when, int modifiers,
 826                                  int keyCode, char keyChar, int keyLocation)
 827     {
 828         LWComponentPeer focusOwner =
 829             LWKeyboardFocusManagerPeer.getInstance(getAppContext()).