jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java
changeset 439 3488710b02f8
parent 2 90ce3da70b43
child 1966 12a51fb0db0d
equal deleted inserted replaced
438:2ae294e4518c 439:3488710b02f8
     1 /*
     1 /*
     2  * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     7  * published by the Free Software Foundation.  Sun designates this
    27 
    27 
    28 import java.security.AccessController;
    28 import java.security.AccessController;
    29 import java.security.PrivilegedAction;
    29 import java.security.PrivilegedAction;
    30 import sun.misc.*;
    30 import sun.misc.*;
    31 
    31 
    32 public class XlibWrapper implements XConstants, XUtilConstants, XProtocolConstants,
    32 final public class XlibWrapper
    33                                     XCursorFontConstants
       
    34 {
    33 {
    35     static Unsafe unsafe = Unsafe.getUnsafe();
    34     static Unsafe unsafe = Unsafe.getUnsafe();
    36     // strange constants
    35     // strange constants
    37     static final int MAXSIZE = 32767;
    36     static final int MAXSIZE = 32767;
    38     static final int MINSIZE = 1;
    37     static final int MINSIZE = 1;
   319                                 int nelements) {
   318                                 int nelements) {
   320         // TODO: handling of XChangePropertyImpl return value, if not Success - don't cache
   319         // TODO: handling of XChangePropertyImpl return value, if not Success - don't cache
   321         if (XPropertyCache.isCachingSupported() &&
   320         if (XPropertyCache.isCachingSupported() &&
   322             XToolkit.windowToXWindow(window) != null &&
   321             XToolkit.windowToXWindow(window) != null &&
   323             WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) &&
   322             WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) &&
   324             mode == PropModeReplace)
   323             mode == XConstants.PropModeReplace)
   325         {
   324         {
   326             int length = (format / 8) * nelements;
   325             int length = (format / 8) * nelements;
   327             XPropertyCache.storeCache(
   326             XPropertyCache.storeCache(
   328                 new XPropertyCache.PropertyCacheEntry(format,
   327                 new XPropertyCache.PropertyCacheEntry(format,
   329                                                       nelements,
   328                                                       nelements,
   583         return dataModel;
   582         return dataModel;
   584     }
   583     }
   585 
   584 
   586     static String hintsToString(long flags) {
   585     static String hintsToString(long flags) {
   587         StringBuffer buf = new StringBuffer();
   586         StringBuffer buf = new StringBuffer();
   588         if ((flags & PMaxSize) != 0) {
   587         if ((flags & XUtilConstants.PMaxSize) != 0) {
   589             buf.append("PMaxSize ");
   588             buf.append("PMaxSize ");
   590         }
   589         }
   591         if ((flags & PMinSize) != 0) {
   590         if ((flags & XUtilConstants.PMinSize) != 0) {
   592             buf.append("PMinSize ");
   591             buf.append("PMinSize ");
   593         }
   592         }
   594         if ((flags & USSize) != 0) {
   593         if ((flags & XUtilConstants.USSize) != 0) {
   595             buf.append("USSize ");
   594             buf.append("USSize ");
   596         }
   595         }
   597         if ((flags & USPosition) != 0) {
   596         if ((flags & XUtilConstants.USPosition) != 0) {
   598             buf.append("USPosition ");
   597             buf.append("USPosition ");
   599         }
   598         }
   600         if ((flags & PPosition) != 0) {
   599         if ((flags & XUtilConstants.PPosition) != 0) {
   601             buf.append("PPosition ");
   600             buf.append("PPosition ");
   602         }
   601         }
   603         if ((flags & PSize) != 0) {
   602         if ((flags & XUtilConstants.PSize) != 0) {
   604             buf.append("PSize ");
   603             buf.append("PSize ");
   605         }
   604         }
   606         if ((flags & PWinGravity) != 0) {
   605         if ((flags & XUtilConstants.PWinGravity) != 0) {
   607             buf.append("PWinGravity ");
   606             buf.append("PWinGravity ");
   608         }
   607         }
   609         return buf.toString();
   608         return buf.toString();
   610     }
   609     }
   611 
   610