< prev index next >

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

Print this page




 658 /* --- DisplayChangedListener Stuff --- */
 659 
 660     /* Xinerama
 661      * called to check if we've been moved onto a different screen
 662      * Based on checkNewXineramaScreen() in awt_GraphicsEnv.c
 663      */
 664     public void checkIfOnNewScreen(Rectangle newBounds) {
 665         if (!XToolkit.localEnv.runningXinerama()) {
 666             return;
 667         }
 668 
 669         if (log.isLoggable(PlatformLogger.Level.FINEST)) {
 670             log.finest("XWindowPeer: Check if we've been moved to a new screen since we're running in Xinerama mode");
 671         }
 672 
 673         int area = newBounds.width * newBounds.height;
 674         int intAmt, vertAmt, horizAmt;
 675         int largestAmt = 0;
 676         int curScreenNum = ((X11GraphicsDevice)getGraphicsConfiguration().getDevice()).getScreen();
 677         int newScreenNum = 0;
 678         GraphicsDevice gds[] = XToolkit.localEnv.getScreenDevices();
 679         GraphicsConfiguration newGC = null;
 680         Rectangle screenBounds;
 681 
 682         XToolkit.awtUnlock();
 683         try {
 684             for (int i = 0; i < gds.length; i++) {
 685                 screenBounds = gds[i].getDefaultConfiguration().getBounds();
 686                 if (newBounds.intersects(screenBounds)) {
 687                     horizAmt = Math.min(newBounds.x + newBounds.width,
 688                                         screenBounds.x + screenBounds.width) -
 689                                Math.max(newBounds.x, screenBounds.x);
 690                     vertAmt = Math.min(newBounds.y + newBounds.height,
 691                                        screenBounds.y + screenBounds.height)-
 692                               Math.max(newBounds.y, screenBounds.y);
 693                     intAmt = horizAmt * vertAmt;
 694                     if (intAmt == area) {
 695                         // Completely on this screen - done!
 696                         newScreenNum = i;
 697                         newGC = gds[i].getDefaultConfiguration();
 698                         break;




 658 /* --- DisplayChangedListener Stuff --- */
 659 
 660     /* Xinerama
 661      * called to check if we've been moved onto a different screen
 662      * Based on checkNewXineramaScreen() in awt_GraphicsEnv.c
 663      */
 664     public void checkIfOnNewScreen(Rectangle newBounds) {
 665         if (!XToolkit.localEnv.runningXinerama()) {
 666             return;
 667         }
 668 
 669         if (log.isLoggable(PlatformLogger.Level.FINEST)) {
 670             log.finest("XWindowPeer: Check if we've been moved to a new screen since we're running in Xinerama mode");
 671         }
 672 
 673         int area = newBounds.width * newBounds.height;
 674         int intAmt, vertAmt, horizAmt;
 675         int largestAmt = 0;
 676         int curScreenNum = ((X11GraphicsDevice)getGraphicsConfiguration().getDevice()).getScreen();
 677         int newScreenNum = 0;
 678         GraphicsDevice[] gds = XToolkit.localEnv.getScreenDevices();
 679         GraphicsConfiguration newGC = null;
 680         Rectangle screenBounds;
 681 
 682         XToolkit.awtUnlock();
 683         try {
 684             for (int i = 0; i < gds.length; i++) {
 685                 screenBounds = gds[i].getDefaultConfiguration().getBounds();
 686                 if (newBounds.intersects(screenBounds)) {
 687                     horizAmt = Math.min(newBounds.x + newBounds.width,
 688                                         screenBounds.x + screenBounds.width) -
 689                                Math.max(newBounds.x, screenBounds.x);
 690                     vertAmt = Math.min(newBounds.y + newBounds.height,
 691                                        screenBounds.y + screenBounds.height)-
 692                               Math.max(newBounds.y, screenBounds.y);
 693                     intAmt = horizAmt * vertAmt;
 694                     if (intAmt == area) {
 695                         // Completely on this screen - done!
 696                         newScreenNum = i;
 697                         newGC = gds[i].getDefaultConfiguration();
 698                         break;


< prev index next >