jdk/src/solaris/classes/sun/awt/X11/XWindow.java
changeset 439 3488710b02f8
parent 116 9c43d9eb1029
child 447 0fb5f354ad70
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Mon Apr 07 14:53:51 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Mon Apr 07 16:52:51 2008 +0400
@@ -178,10 +178,10 @@
         AwtGraphicsConfigData gData = getGraphicsConfigurationData();
         X11GraphicsConfig config = (X11GraphicsConfig) getGraphicsConfiguration();
         XVisualInfo visInfo = gData.get_awt_visInfo();
-        params.putIfNull(EVENT_MASK, KeyPressMask | KeyReleaseMask
-            | FocusChangeMask | ButtonPressMask | ButtonReleaseMask
-            | EnterWindowMask | LeaveWindowMask | PointerMotionMask
-            | ButtonMotionMask | ExposureMask | StructureNotifyMask);
+        params.putIfNull(EVENT_MASK, XConstants.KeyPressMask | XConstants.KeyReleaseMask
+            | XConstants.FocusChangeMask | XConstants.ButtonPressMask | XConstants.ButtonReleaseMask
+            | XConstants.EnterWindowMask | XConstants.LeaveWindowMask | XConstants.PointerMotionMask
+            | XConstants.ButtonMotionMask | XConstants.ExposureMask | XConstants.StructureNotifyMask);
 
         if (target != null) {
             params.putIfNull(BOUNDS, target.getBounds());
@@ -192,9 +192,9 @@
         getColorModel(); // fix 4948833: this call forces the color map to be initialized
         params.putIfNull(COLORMAP, gData.get_awt_cmap());
         params.putIfNull(DEPTH, gData.get_awt_depth());
-        params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XlibWrapper.InputOutput));
+        params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XConstants.InputOutput));
         params.putIfNull(VISUAL, visInfo.get_visual());
-        params.putIfNull(VALUE_MASK, XlibWrapper.CWBorderPixel | XlibWrapper.CWEventMask | XlibWrapper.CWColormap);
+        params.putIfNull(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWEventMask | XConstants.CWColormap);
         Long parentWindow = (Long)params.get(PARENT_WINDOW);
         if (parentWindow == null || parentWindow.longValue() == 0) {
             XToolkit.awtLock();
@@ -553,10 +553,10 @@
     static int getModifiers(int state, int button, int keyCode) {
         int modifiers = 0;
 
-        if (((state & XlibWrapper.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
+        if (((state & XConstants.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
             modifiers |= InputEvent.SHIFT_DOWN_MASK;
         }
-        if (((state & XlibWrapper.ControlMask) != 0) ^ (keyCode == KeyEvent.VK_CONTROL)) {
+        if (((state & XConstants.ControlMask) != 0) ^ (keyCode == KeyEvent.VK_CONTROL)) {
             modifiers |= InputEvent.CTRL_DOWN_MASK;
         }
         if (((state & XToolkit.metaMask) != 0) ^ (keyCode == KeyEvent.VK_META)) {
@@ -568,13 +568,13 @@
         if (((state & XToolkit.modeSwitchMask) != 0) ^ (keyCode == KeyEvent.VK_ALT_GRAPH)) {
             modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
         }
-        if (((state & XlibWrapper.Button1Mask) != 0) ^ (button == MouseEvent.BUTTON1)) {
+        if (((state & XConstants.Button1Mask) != 0) ^ (button == MouseEvent.BUTTON1)) {
             modifiers |= InputEvent.BUTTON1_DOWN_MASK;
         }
-        if (((state & XlibWrapper.Button2Mask) != 0) ^ (button == MouseEvent.BUTTON2)) {
+        if (((state & XConstants.Button2Mask) != 0) ^ (button == MouseEvent.BUTTON2)) {
             modifiers |= InputEvent.BUTTON2_DOWN_MASK;
         }
-        if (((state & XlibWrapper.Button3Mask) != 0) ^ (button == MouseEvent.BUTTON3)) {
+        if (((state & XConstants.Button3Mask) != 0) ^ (button == MouseEvent.BUTTON3)) {
             modifiers |= InputEvent.BUTTON3_DOWN_MASK;
         }
         return modifiers;
@@ -584,10 +584,10 @@
         int mods = stroke.getModifiers();
         int res = 0;
         if ((mods & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) {
-            res |= XToolkit.ShiftMask;
+            res |= XConstants.ShiftMask;
         }
         if ((mods & (InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK)) != 0) {
-            res |= XToolkit.ControlMask;
+            res |= XConstants.ControlMask;
         }
         if ((mods & (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) != 0) {
             res |= XToolkit.altMask;
@@ -602,12 +602,12 @@
     }
 
     private static int getButtonMask(long mouseButton) {
-        if (mouseButton == XlibWrapper.Button1) {
-            return XlibWrapper.Button1Mask;
-        } else if (mouseButton == XlibWrapper.Button2) {
-            return XlibWrapper.Button2Mask;
-        } else if (mouseButton == XlibWrapper.Button3) {
-            return XlibWrapper.Button3Mask;
+        if (mouseButton == XConstants.Button1) {
+            return XConstants.Button1Mask;
+        } else if (mouseButton == XConstants.Button2) {
+            return XConstants.Button2Mask;
+        } else if (mouseButton == XConstants.Button3) {
+            return XConstants.Button3Mask;
         }
         return 0;
     }
@@ -659,7 +659,7 @@
             y = localXY.y;
         }
 
-        if (type == XlibWrapper.ButtonPress) {
+        if (type == XConstants.ButtonPress) {
             XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
             /*
                multiclick checking
@@ -689,16 +689,16 @@
             }
         }
 
-        if (lbutton == XlibWrapper.Button1)
+        if (lbutton == XConstants.Button1)
             button = MouseEvent.BUTTON1;
-        else if (lbutton ==  XlibWrapper.Button2 )
+        else if (lbutton ==  XConstants.Button2 )
             button = MouseEvent.BUTTON2;
-        else if (lbutton == XlibWrapper.Button3)
+        else if (lbutton == XConstants.Button3)
             button = MouseEvent.BUTTON3;
-        else if (lbutton == XlibWrapper.Button4) {
+        else if (lbutton == XConstants.Button4) {
             button = 4;
             wheel_mouse = true;
-        } else if (lbutton == XlibWrapper.Button5) {
+        } else if (lbutton == XConstants.Button5) {
             button = 5;
             wheel_mouse = true;
         }
@@ -707,7 +707,7 @@
 
         if (!wheel_mouse) {
             MouseEvent me = new MouseEvent((Component)getEventSource(),
-                                           type == XlibWrapper.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
+                                           type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
                                            jWhen,modifiers, x, y,
                                            xbe.get_x_root(),
                                            xbe.get_y_root(),
@@ -716,7 +716,7 @@
             postEventToEventQueue(me);
 
             if (((mouseDragState & getButtonMask(lbutton)) == 0) && // No up-button in the drag-state
-                (type == XlibWrapper.ButtonRelease))
+                (type == XConstants.ButtonRelease))
             {
                 postEventToEventQueue(me = new MouseEvent((Component)getEventSource(),
                                                      MouseEvent.MOUSE_CLICKED,
@@ -731,7 +731,7 @@
 
         }
         else {
-            if (xev.get_type() == XlibWrapper.ButtonPress) {
+            if (xev.get_type() == XConstants.ButtonPress) {
                 MouseWheelEvent mwe = new MouseWheelEvent((Component)getEventSource(),MouseEvent.MOUSE_WHEEL, jWhen,
                                                           modifiers,
                                                           x, y,
@@ -753,7 +753,7 @@
             return;
         }
 
-        int mouseKeyState = (xme.get_state() & (Button1Mask | Button2Mask | Button3Mask));
+        int mouseKeyState = (xme.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask | XConstants.Button3Mask));
         boolean isDragging = (mouseKeyState != 0);
         int mouseEventType = 0;
 
@@ -823,10 +823,10 @@
         // accordingly. This leads to impossibility to make a double click on Component (6404708)
         XWindowPeer toplevel = getToplevelXWindow();
         if (toplevel != null && !toplevel.isModalBlocked()){
-            if (xce.get_mode() != NotifyNormal) {
+            if (xce.get_mode() != XConstants.NotifyNormal) {
                 // 6404708 : need update cursor in accordance with skipping Leave/EnterNotify event
                 // whereas it doesn't need to handled further.
-                if (xce.get_type() == EnterNotify) {
+                if (xce.get_type() == XConstants.EnterNotify) {
                     XAwtState.setComponentMouseEntered(getEventSource());
                     XGlobalCursorManager.nativeUpdateCursor(getEventSource());
                 } else { // LeaveNotify:
@@ -840,7 +840,7 @@
         // From java point the event is bogus as ancestor is obscured, so if
         // the child can get java event itself, we skip it on ancestor.
         long childWnd = xce.get_subwindow();
-        if (childWnd != None) {
+        if (childWnd != XConstants.None) {
             XBaseWindow child = XToolkit.windowToXWindow(childWnd);
             if (child != null && child instanceof XWindow &&
                 !child.isEventDisabled(xev))
@@ -853,7 +853,7 @@
         final Component compWithMouse = XAwtState.getComponentMouseEntered();
         if (toplevel != null) {
             if(!toplevel.isModalBlocked()){
-                if (xce.get_type() == EnterNotify) {
+                if (xce.get_type() == XConstants.EnterNotify) {
                     // Change XAwtState's component mouse entered to the up-to-date one before requesting
                     // to update the cursor since XAwtState.getComponentMouseEntered() is used when the
                     // cursor is updated (in XGlobalCursorManager.findHeavyweightUnderCursor()).
@@ -895,7 +895,7 @@
             eventLog.finest("Clearing last window ref");
             lastWindowRef = null;
         }
-        if (xce.get_type() == EnterNotify) {
+        if (xce.get_type() == XConstants.EnterNotify) {
             MouseEvent me = new MouseEvent(getEventSource(), MouseEvent.MOUSE_ENTERED,
                 jWhen, modifiers, xce.get_x(), xce.get_y(), xce.get_x_root(), xce.get_y_root(), clickCount,
                 popupTrigger, MouseEvent.NOBUTTON);
@@ -990,7 +990,7 @@
     final void handleKeyPress(XKeyEvent ev) {
         long keysym[] = new long[2];
         char unicodeKey = 0;
-        keysym[0] = NoSymbol;
+        keysym[0] = XConstants.NoSymbol;
 
         if (keyEventLog.isLoggable(Level.FINE)) {
             logIncomingKeyEvent( ev );
@@ -1073,7 +1073,7 @@
     private void handleKeyRelease(XKeyEvent ev) {
         long keysym[] = new long[2];
         char unicodeKey = 0;
-        keysym[0] = NoSymbol;
+        keysym[0] = XConstants.NoSymbol;
 
         if (keyEventLog.isLoggable(Level.FINE)) {
             logIncomingKeyEvent( ev );
@@ -1153,10 +1153,10 @@
     }
 
     void updateSizeHints(int x, int y, int width, int height) {
-        long flags = XlibWrapper.PSize | (isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition));
+        long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition));
         if (!isResizable()) {
             log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
-            flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize;
+            flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize;
         } else {
             log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
         }
@@ -1164,10 +1164,10 @@
     }
 
     void updateSizeHints(int x, int y) {
-        long flags = isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition);
+        long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition);
         if (!isResizable()) {
             log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
-            flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize | XlibWrapper.PSize;
+            flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize;
         } else {
             log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
         }