Changeset 5504 in josm


Ignore:
Timestamp:
2012-09-07T23:11:08+02:00 (9 years ago)
Author:
Don-vip
Message:

fix #8021 - division by 0 when getting screen info at startup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java

    r5142 r5504  
    277277        for (int j = 0; j < gs.length; j++) {
    278278            GraphicsDevice gd = gs[j];
    279             GraphicsConfiguration[] gc = gd.getConfigurations();
    280             for (int i = 0; i < gc.length; i++) {
    281                 virtualBounds = virtualBounds.union(gc[i].getBounds());
     279            if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
     280                virtualBounds = virtualBounds.union(gd.getDefaultConfiguration().getBounds());
    282281            }
    283282        }
     
    316315        for (int j = 0; j < gs.length; j++) {
    317316            GraphicsDevice gd = gs[j];
    318             GraphicsConfiguration[] gc = gd.getConfigurations();
    319             for (int i = 0; i < gc.length; i++) {
    320                 Rectangle b = gc[i].getBounds();
    321                 if(b.width/b.height >= 3) /* multiscreen with wrong definition */
     317            if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
     318                Rectangle b = gd.getDefaultConfiguration().getBounds();
     319                if (b.height > 0 && b.width/b.height >= 3) /* multiscreen with wrong definition */
    322320                {
    323321                    b.width /= 2;
Note: See TracChangeset for help on using the changeset viewer.