1008
1009 public void handleVisibilityEvent(XEvent xev) {
1010 }
1011 public void handleKeyPress(XEvent xev) {
1012 }
1013 public void handleKeyRelease(XEvent xev) {
1014 }
1015 public void handleExposeEvent(XEvent xev) {
1016 }
1017 /**
1018 * Activate automatic grab on first ButtonPress,
1019 * deactivate on full mouse release
1020 */
1021 public void handleButtonPressRelease(XEvent xev) {
1022 XButtonEvent xbe = xev.get_xbutton();
1023 /*
1024 * Ignore the buttons above 20 due to the bit limit for
1025 * InputEvent.BUTTON_DOWN_MASK.
1026 * One more bit is reserved for FIRST_HIGH_BIT.
1027 */
1028 if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
1029 return;
1030 }
1031 int buttonState = 0;
1032 buttonState = xbe.get_state() & XConstants.ALL_BUTTONS_MASK;
1033 switch (xev.get_type()) {
1034 case XConstants.ButtonPress:
1035 if (buttonState == 0) {
1036 XWindowPeer parent = getToplevelXWindow();
1037 // See 6385277, 6981400.
1038 if (parent != null && parent.isFocusableWindow()) {
1039 // A click in a client area drops the actual focused window retaining.
1040 parent.setActualFocusedWindow(null);
1041 parent.requestWindowFocus(xbe.get_time(), true);
1042 }
1043 XAwtState.setAutoGrabWindow(this);
1044 }
1045 break;
1046 case XConstants.ButtonRelease:
1047 if (isFullRelease(buttonState, xbe.get_button())) {
1048 XAwtState.setAutoGrabWindow(null);
1049 }
1050 break;
1051 }
1052 }
1053 public void handleMotionNotify(XEvent xev) {
1054 }
1055 public void handleXCrossingEvent(XEvent xev) {
1056 }
1057 public void handleConfigureNotifyEvent(XEvent xev) {
1058 XConfigureEvent xe = xev.get_xconfigure();
1059 if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
1060 insLog.finer("Configure, {0}", xe);
1061 }
1062
1063 x = scaleDown(xe.get_x());
1064 y = scaleDown(xe.get_y());
1065 width = scaleDown(xe.get_width());
1066 height = scaleDown(xe.get_height());
1067 }
1068 /**
1069 * Checks ButtonRelease released all Mouse buttons
1070 */
|
1008
1009 public void handleVisibilityEvent(XEvent xev) {
1010 }
1011 public void handleKeyPress(XEvent xev) {
1012 }
1013 public void handleKeyRelease(XEvent xev) {
1014 }
1015 public void handleExposeEvent(XEvent xev) {
1016 }
1017 /**
1018 * Activate automatic grab on first ButtonPress,
1019 * deactivate on full mouse release
1020 */
1021 public void handleButtonPressRelease(XEvent xev) {
1022 XButtonEvent xbe = xev.get_xbutton();
1023 /*
1024 * Ignore the buttons above 20 due to the bit limit for
1025 * InputEvent.BUTTON_DOWN_MASK.
1026 * One more bit is reserved for FIRST_HIGH_BIT.
1027 */
1028 int theButton = xbe.get_button();
1029 if (theButton > SunToolkit.MAX_BUTTONS_SUPPORTED) {
1030 return;
1031 }
1032 int buttonState = 0;
1033 buttonState = xbe.get_state() & XConstants.ALL_BUTTONS_MASK;
1034
1035 boolean isWheel = (theButton != XConstants.MouseWheelUp ||
1036 theButton != XConstants.MouseWheelDown);
1037
1038 // don't give focus if it's just the mouse wheel turning
1039 if (!isWheel) {
1040 switch (xev.get_type()) {
1041 case XConstants.ButtonPress:
1042 if (buttonState == 0) {
1043 XWindowPeer parent = getToplevelXWindow();
1044 // See 6385277, 6981400.
1045 if (parent != null && parent.isFocusableWindow()) {
1046 // A click in a client area drops the actual focused window retaining.
1047 parent.setActualFocusedWindow(null);
1048 parent.requestWindowFocus(xbe.get_time(), true);
1049 }
1050 XAwtState.setAutoGrabWindow(this);
1051 }
1052 break;
1053 case XConstants.ButtonRelease:
1054 if (isFullRelease(buttonState, xbe.get_button())) {
1055 XAwtState.setAutoGrabWindow(null);
1056 }
1057 break;
1058 }
1059 }
1060 }
1061 public void handleMotionNotify(XEvent xev) {
1062 }
1063 public void handleXCrossingEvent(XEvent xev) {
1064 }
1065 public void handleConfigureNotifyEvent(XEvent xev) {
1066 XConfigureEvent xe = xev.get_xconfigure();
1067 if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
1068 insLog.finer("Configure, {0}", xe);
1069 }
1070
1071 x = scaleDown(xe.get_x());
1072 y = scaleDown(xe.get_y());
1073 width = scaleDown(xe.get_width());
1074 height = scaleDown(xe.get_height());
1075 }
1076 /**
1077 * Checks ButtonRelease released all Mouse buttons
1078 */
|