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

Print this page




 767             Point lp = targetPeer.windowToLocal(x, y, curWindowPeer);
 768             if (targetPeer.isEnabled()) {
 769                 MouseEvent event = new MouseEvent(targetPeer.getTarget(), id,
 770                                                   when, modifiers, lp.x, lp.y,
 771                                                   screenX, screenY, clickCount,
 772                                                   popupTrigger, button);
 773                 postEvent(event);
 774             }
 775 
 776             if (id == MouseEvent.MOUSE_RELEASED) {
 777                 if ((mouseClickButtons & eventButtonMask) != 0
 778                     && targetPeer.isEnabled()) {
 779                     postEvent(new MouseEvent(targetPeer.getTarget(),
 780                                              MouseEvent.MOUSE_CLICKED,
 781                                              when, modifiers,
 782                                              lp.x, lp.y, screenX, screenY,
 783                                              clickCount, popupTrigger, button));
 784                 }
 785                 mouseClickButtons &= ~eventButtonMask;
 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,


1038      *
1039      * This method may be called on the toolkit thread.
1040      */
1041     public boolean updateInsets(Insets newInsets) {
1042         boolean changed = false;
1043         synchronized (getStateLock()) {
1044             changed = (insets.equals(newInsets));
1045             insets = newInsets;
1046         }
1047 
1048         if (changed) {
1049             replaceSurfaceData();
1050             repaintPeer();
1051         }
1052 
1053         return changed;
1054     }
1055 
1056     public static LWWindowPeer getWindowUnderCursor() {
1057         return lastMouseEventPeer != null ? lastMouseEventPeer.getWindowPeerOrSelf() : null;




1058     }
1059 
1060     public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
1061         if (focusLog.isLoggable(PlatformLogger.FINE)) {
1062             focusLog.fine("requesting native focus to " + this);
1063         }
1064 
1065         if (!focusAllowedFor()) {
1066             focusLog.fine("focus is not allowed");
1067             return false;
1068         }
1069 
1070         if (platformWindow.rejectFocusRequest(cause)) {
1071             return false;
1072         }
1073 
1074         Window currentActive = KeyboardFocusManager.
1075             getCurrentKeyboardFocusManager().getActiveWindow();
1076 
1077         // Make the owner active window.




 767             Point lp = targetPeer.windowToLocal(x, y, curWindowPeer);
 768             if (targetPeer.isEnabled()) {
 769                 MouseEvent event = new MouseEvent(targetPeer.getTarget(), id,
 770                                                   when, modifiers, lp.x, lp.y,
 771                                                   screenX, screenY, clickCount,
 772                                                   popupTrigger, button);
 773                 postEvent(event);
 774             }
 775 
 776             if (id == MouseEvent.MOUSE_RELEASED) {
 777                 if ((mouseClickButtons & eventButtonMask) != 0
 778                     && targetPeer.isEnabled()) {
 779                     postEvent(new MouseEvent(targetPeer.getTarget(),
 780                                              MouseEvent.MOUSE_CLICKED,
 781                                              when, modifiers,
 782                                              lp.x, lp.y, screenX, screenY,
 783                                              clickCount, popupTrigger, button));
 784                 }
 785                 mouseClickButtons &= ~eventButtonMask;
 786             }


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


1037      *
1038      * This method may be called on the toolkit thread.
1039      */
1040     public boolean updateInsets(Insets newInsets) {
1041         boolean changed = false;
1042         synchronized (getStateLock()) {
1043             changed = (insets.equals(newInsets));
1044             insets = newInsets;
1045         }
1046 
1047         if (changed) {
1048             replaceSurfaceData();
1049             repaintPeer();
1050         }
1051 
1052         return changed;
1053     }
1054 
1055     public static LWWindowPeer getWindowUnderCursor() {
1056         return lastMouseEventPeer != null ? lastMouseEventPeer.getWindowPeerOrSelf() : null;
1057     }
1058 
1059     public static LWComponentPeer<?, ?> getPeerUnderCursor() {
1060         return lastMouseEventPeer;
1061     }
1062 
1063     public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
1064         if (focusLog.isLoggable(PlatformLogger.FINE)) {
1065             focusLog.fine("requesting native focus to " + this);
1066         }
1067 
1068         if (!focusAllowedFor()) {
1069             focusLog.fine("focus is not allowed");
1070             return false;
1071         }
1072 
1073         if (platformWindow.rejectFocusRequest(cause)) {
1074             return false;
1075         }
1076 
1077         Window currentActive = KeyboardFocusManager.
1078             getCurrentKeyboardFocusManager().getActiveWindow();
1079 
1080         // Make the owner active window.