Changeset 13181 in josm for trunk/src


Ignore:
Timestamp:
2017-12-02T15:13:32+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #15599 - Improvements for testing painting (last patches by ris)

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

Legend:

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

    r13175 r13181  
    33
    44import java.awt.Container;
     5import java.awt.GraphicsEnvironment;
    56import java.awt.Point;
    67import java.awt.geom.AffineTransform;
     
    145146
    146147    private static Point findTopLeftOnScreen(JComponent position) {
    147         try {
    148             return position.getLocationOnScreen();
    149         } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
    150             throw BugReport.intercept(e).put("position", position).put("parent", position::getParent);
     148        if (GraphicsEnvironment.isHeadless()) {
     149            // in our imaginary universe the window is always (10, 10) from the top left of the screen
     150            Point topLeftInWindow = findTopLeftInWindow(position);
     151            return new Point(topLeftInWindow.x + 10, topLeftInWindow.y + 10);
     152        } else {
     153            try {
     154                return position.getLocationOnScreen();
     155            } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
     156                throw BugReport.intercept(e).put("position", position).put("parent", position::getParent);
     157            }
    151158        }
    152159    }
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r13154 r13181  
    33
    44import java.awt.Cursor;
     5import java.awt.GraphicsEnvironment;
    56import java.awt.Point;
    67import java.awt.Rectangle;
     
    320321
    321322    protected boolean isVisibleOnScreen() {
    322         return SwingUtilities.getWindowAncestor(this) != null && isShowing();
     323        return GraphicsEnvironment.isHeadless() || (
     324            SwingUtilities.getWindowAncestor(this) != null && isShowing()
     325        );
    323326    }
    324327
Note: See TracChangeset for help on using the changeset viewer.