< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XlibUtil.java

Print this page




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.X11;
  27 
  28 import java.awt.Dimension;
  29 import java.awt.GraphicsEnvironment;
  30 import java.awt.Point;
  31 import java.awt.Rectangle;
  32 
  33 import java.util.Collections;
  34 import java.util.HashSet;
  35 import java.util.Set;
  36 
  37 import sun.awt.X11GraphicsConfig;
  38 import sun.awt.X11GraphicsDevice;
  39 import sun.awt.X11GraphicsEnvironment;
  40 


  41 /*
  42  * This class is a collection of utility methods that operate
  43  * with native windows.
  44  */
  45 public class XlibUtil
  46 {
  47     /**
  48      * The constructor is made private to eliminate any
  49      * instances of this class
  50     */
  51     private XlibUtil()
  52     {
  53     }
  54 
  55     /**
  56      * Xinerama-aware version of XlibWrapper.RootWindow method.
  57      */
  58     public static long getRootWindow(int screenNumber)
  59     {
  60         XToolkit.awtLock();


 397             } finally {
 398                 XToolkit.awtUnlock();
 399             }
 400         }
 401 
 402         return isShapingSupported.booleanValue();
 403     }
 404 
 405     static int getButtonMask(int button) {
 406         // Button indices start with 1. The first bit in the button mask is the 8th.
 407         // The state mask does not support button indicies > 5, so we need to
 408         // cut there.
 409         if (button <= 0 || button > XConstants.MAX_BUTTONS) {
 410             return 0;
 411         } else {
 412             return 1 << (7 + button);
 413         }
 414     }
 415 
 416     static int scaleDown(int x, int scale) {
 417         return x / scale;
 418     }
 419 }


  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.X11;
  27 
  28 import java.awt.Dimension;
  29 import java.awt.GraphicsEnvironment;
  30 import java.awt.Point;
  31 import java.awt.Rectangle;
  32 
  33 import java.util.Collections;
  34 import java.util.HashSet;
  35 import java.util.Set;
  36 
  37 import sun.awt.X11GraphicsConfig;
  38 import sun.awt.X11GraphicsDevice;
  39 import sun.awt.X11GraphicsEnvironment;
  40 
  41 import sun.java2d.pipe.Region;
  42 
  43 /*
  44  * This class is a collection of utility methods that operate
  45  * with native windows.
  46  */
  47 public class XlibUtil
  48 {
  49     /**
  50      * The constructor is made private to eliminate any
  51      * instances of this class
  52     */
  53     private XlibUtil()
  54     {
  55     }
  56 
  57     /**
  58      * Xinerama-aware version of XlibWrapper.RootWindow method.
  59      */
  60     public static long getRootWindow(int screenNumber)
  61     {
  62         XToolkit.awtLock();


 399             } finally {
 400                 XToolkit.awtUnlock();
 401             }
 402         }
 403 
 404         return isShapingSupported.booleanValue();
 405     }
 406 
 407     static int getButtonMask(int button) {
 408         // Button indices start with 1. The first bit in the button mask is the 8th.
 409         // The state mask does not support button indicies > 5, so we need to
 410         // cut there.
 411         if (button <= 0 || button > XConstants.MAX_BUTTONS) {
 412             return 0;
 413         } else {
 414             return 1 << (7 + button);
 415         }
 416     }
 417 
 418     static int scaleDown(int x, int scale) {
 419         return Region.clipRound(x / (double)scale);
 420     }
 421 }
< prev index next >