Changeset 6828 in josm for trunk


Ignore:
Timestamp:
2014-02-09T14:31:13+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #9699 - workaround to java bug in getMaximumWindowBounds() (patch by kendzi)

File:
1 edited

Legend:

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

    r6822 r6828  
    323323        Rectangle maxbounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    324324
    325         deltax = size.width - maxbounds.width;
    326         if (deltax > 0) {
    327             size.width -= deltax;
    328         }
    329 
    330         deltay = size.height - maxbounds.height;
    331         if (deltay > 0) {
    332             size.height -= deltay;
    333         }
    334 
     325        if (!isBugInMaximumWindowBounds(maxbounds)) {
     326            deltax = size.width - maxbounds.width;
     327            if (deltax > 0) {
     328                size.width -= deltax;
     329            }
     330
     331            deltay = size.height - maxbounds.height;
     332            if (deltay > 0) {
     333                size.height -= deltay;
     334            }
     335        }
    335336        window.setLocation(p);
    336337        window.setSize(size);
     338    }
     339
     340    /**
     341     * Determines if the bug affecting getMaximumWindowBounds() occured.
     342     *
     343     * @param maxbounds result of getMaximumWindowBounds()
     344     * @return {@code true} if the bug happened, {@code false otherwise}
     345     *
     346     * @see <a href="https://josm.openstreetmap.de/ticket/9699">JOSM-9699</a>
     347     * @see <a href="https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/1171563">Ubuntu-1171563</a>
     348     * @see <a href="http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1669">IcedTea-1669</a>
     349     * @see <a href="https://bugs.openjdk.java.net/browse/JI-9010334">JI-9010334</a>
     350     */
     351    protected static boolean isBugInMaximumWindowBounds(Rectangle maxbounds) {
     352        return maxbounds.width <= 0 || maxbounds.height <= 0;
    337353    }
    338354
Note: See TracChangeset for help on using the changeset viewer.