Ticket #9699: WindowGeometry.java.patch

File WindowGeometry.java.patch, 1.9 KB (added by kendzi, 10 years ago)
  • src/org/openstreetmap/josm/tools/WindowGeometry.java

     
    322322
    323323        Rectangle maxbounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    324324
    325         deltax = size.width - maxbounds.width;
    326         if (deltax > 0) {
    327             size.width -= deltax;
    328         }
     325        if (!isBugInMaximumWindowBounds(maxbounds)) {
    329326
    330         deltay = size.height - maxbounds.height;
    331         if (deltay > 0) {
    332             size.height -= deltay;
    333         }
     327            deltax = size.width - maxbounds.width;
     328            if (deltax > 0) {
     329                size.width -= deltax;
     330            }
    334331
     332            deltay = size.height - maxbounds.height;
     333            if (deltay > 0) {
     334                size.height -= deltay;
     335            }
     336        }
    335337        window.setLocation(p);
    336338        window.setSize(size);
    337339    }
    338340
    339341    /**
     342     * Because of bug in getMaximumWindowBounds on dual screen Ubuntu. Function
     343     * return incorrect values with minus sign or extremely large. This cause
     344     * incorrect bounds and main windows is created with only few pixel with.
     345     * More details in #9699.
     346     *
     347     * @param maxbounds
     348     *            result of getMaximumWindowBounds
     349     * @return is bug in result of getMaximumWindowBounds
     350     */
     351    private boolean isBugInMaximumWindowBounds(Rectangle maxbounds) {
     352        return maxbounds.width <= 0 || maxbounds.height <= 0 || maxbounds.x > 1000 || maxbounds.y > 1000;
     353    }
     354
     355    /**
    340356     * Computes the virtual bounds of graphics environment, as an union of all screen bounds.
    341357     * @return The virtual bounds of graphics environment, as an union of all screen bounds.
    342358     * @since 6522