jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java
changeset 2810 fa49c6a06baf
parent 2471 71401ceec494
child 3234 f0007f6747b0
equal deleted inserted replaced
2809:b373581f6507 2810:fa49c6a06baf
   987      * Activate automatic grab on first ButtonPress,
   987      * Activate automatic grab on first ButtonPress,
   988      * deactivate on full mouse release
   988      * deactivate on full mouse release
   989      */
   989      */
   990     public void handleButtonPressRelease(XEvent xev) {
   990     public void handleButtonPressRelease(XEvent xev) {
   991         XButtonEvent xbe = xev.get_xbutton();
   991         XButtonEvent xbe = xev.get_xbutton();
       
   992         /*
       
   993          * Ignore the buttons above 20 due to the bit limit for
       
   994          * InputEvent.BUTTON_DOWN_MASK.
       
   995          * One more bit is reserved for FIRST_HIGH_BIT.
       
   996          */
       
   997         if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
       
   998             return;
       
   999         }
   992         int buttonState = 0;
  1000         int buttonState = 0;
   993         for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
  1001         final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
       
  1002         for (int i = 0; i<buttonsNumber; i++){
   994             // A bug in WM implementation: extra buttons doesn't have state!=0 as they should on Release message.
  1003             // A bug in WM implementation: extra buttons doesn't have state!=0 as they should on Release message.
   995             if ((i != 4) && (i != 5)){
  1004             if ((i != 4) && (i != 5)){
   996                 buttonState |= (xbe.get_state() & XConstants.buttonsMask[i]);
  1005                 buttonState |= (xbe.get_state() & XConstants.buttonsMask[i]);
   997             }
  1006             }
   998         }
  1007         }
  1024     }
  1033     }
  1025     /**
  1034     /**
  1026      * Checks ButtonRelease released all Mouse buttons
  1035      * Checks ButtonRelease released all Mouse buttons
  1027      */
  1036      */
  1028     static boolean isFullRelease(int buttonState, int button) {
  1037     static boolean isFullRelease(int buttonState, int button) {
  1029         if (button < 0 || button > XToolkit.getNumMouseButtons()) {
  1038         final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
       
  1039 
       
  1040         if (button < 0 || button > buttonsNumber) {
  1030             return buttonState == 0;
  1041             return buttonState == 0;
  1031         } else {
  1042         } else {
  1032             return buttonState == XConstants.buttonsMask[button - 1];
  1043             return buttonState == XConstants.buttonsMask[button - 1];
  1033         }
  1044         }
  1034     }
  1045     }