Changeset 13963 in josm


Ignore:
Timestamp:
2018-06-21T16:06:43+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16410 - workaround for "IllegalArgumentException: Window must not be zero" on Linux (patch by kendzi)

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r13960 r13963  
    10301030        // splash can be null sometimes on Linux, in this case try to load JOSM silently
    10311031        final SplashProgressMonitor monitor = splash != null ? splash.getProgressMonitor() : new SplashProgressMonitor(null, e -> {
    1032             Logging.debug(e.toString());
     1032            if (e != null) {
     1033                Logging.debug(e.toString());
     1034            }
    10331035        });
    10341036        monitor.beginTask(tr("Initializing"));
  • trunk/src/org/openstreetmap/josm/gui/util/WindowGeometry.java

    r12846 r13963  
    343343
    344344        // Ensure window does not hide taskbar
    345 
    346         Rectangle maxbounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    347 
    348         if (!isBugInMaximumWindowBounds(maxbounds)) {
    349             deltax = size.width - maxbounds.width;
    350             if (deltax > 0) {
    351                 size.width -= deltax;
     345        try {
     346            Rectangle maxbounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
     347
     348            if (!isBugInMaximumWindowBounds(maxbounds)) {
     349                deltax = size.width - maxbounds.width;
     350                if (deltax > 0) {
     351                    size.width -= deltax;
     352                }
     353
     354                deltay = size.height - maxbounds.height;
     355                if (deltay > 0) {
     356                    size.height -= deltay;
     357                }
    352358            }
    353 
    354             deltay = size.height - maxbounds.height;
    355             if (deltay > 0) {
    356                 size.height -= deltay;
    357             }
     359        } catch (IllegalArgumentException e) {
     360            // See #16410: IllegalArgumentException: "Window must not be zero" on Linux/X11
     361            Logging.error(e);
    358362        }
    359363        window.setLocation(p);
Note: See TracChangeset for help on using the changeset viewer.