@Override
  int getCursorType(Component view, Point location) {
    Component parent = view instanceof Window ? null : view.getParent();
    if (parent != null) {
      convertPointFromScreen(location, parent);
    }
    Rectangle bounds = view.getBounds();
    boolean isWayland = StartupUiUtil.isWaylandToolkit();
    if (isWayland) {
      // The location of the window on the screen is not known, so whatever those
      // numbers are, disregard ethem for the purpose of the comparisons below.
      bounds.x = 0;
      bounds.y = 0;
    }
    JBInsets.removeFrom(bounds, getResizeOffset(view));

    int top = location.y - bounds.y;
    if (top < 0) return CUSTOM_CURSOR;

    int left = location.x - bounds.x;
    if (left < 0) return CUSTOM_CURSOR;

    int right = bounds.width - left;
    if (right < 0) return CUSTOM_CURSOR;

    int bottom = bounds.height - top;
    if (bottom < 0) return CUSTOM_CURSOR;

    if (myCorner != null && right < myCorner.getIconWidth() && bottom < myCorner.getIconHeight()) {
      return DEFAULT_CURSOR;
    }
    Insets expected = getResizeBorder(view);
    if (expected != null) {
      if (view instanceof Frame) {
        int state = ((Frame)view).getExtendedState();
        if (isStateSet(Frame.MAXIMIZED_HORIZ, state)) {
          left = Integer.MAX_VALUE;
          right = Integer.MAX_VALUE;
        }
        if (isStateSet(Frame.MAXIMIZED_VERT, state)) {
          top = Integer.MAX_VALUE;
          bottom = Integer.MAX_VALUE;
        }
      }

      // Wayland doesn't allow to change window's location programmatically,
      // so resizing from top/left shall be forbidden for now.
      if (!isWayland && top < expected.top) {
        if (left < expected.left * 2) return NW_RESIZE_CURSOR;
        if (right < expected.right * 2) return NE_RESIZE_CURSOR;
        return N_RESIZE_CURSOR;
      }
      if (bottom < expected.bottom) {
        if (!isWayland && left < expected.left * 2) return SW_RESIZE_CURSOR;
        if (right < expected.right * 2) return SE_RESIZE_CURSOR;
        return S_RESIZE_CURSOR;
      }
      if (!isWayland && left < expected.left) {
        if (top < expected.top * 2 ) return NW_RESIZE_CURSOR;
        if (bottom < expected.bottom * 2) return SW_RESIZE_CURSOR;
        return W_RESIZE_CURSOR;
      }
      if (right < expected.right) {
        if (!isWayland && top < expected.top * 2) return NE_RESIZE_CURSOR;
        if (bottom < expected.bottom * 2) return SE_RESIZE_CURSOR;
        return E_RESIZE_CURSOR;
      }
    }
    return CUSTOM_CURSOR;
  }
@Override
  int getCursorType(Component view, Point location)