/**
   * Converts the specified mouse event's screen point from WebView coordinates to Windows
   * coordinates, and returns a new event who's screen point is in Windows coordinates, with the
   * origin at the upper left corner of the WebView window.
   *
   * @param e The event to convert.
   * @return A new mouse event in the Windows coordinate system.
   */
  protected MouseEvent convertToWindows(MouseEvent e) {
    int x = e.getX();
    int y = e.getY();

    // Translate OpenGL screen coordinates to Windows by moving the Y origin from the lower left
    // corner to
    // the upper left corner and flipping the direction of the Y axis.
    y = this.frameSize.height - y;

    if (e instanceof MouseWheelEvent) {
      return new MouseWheelEvent(
          (Component) e.getSource(),
          e.getID(),
          e.getWhen(),
          e.getModifiers(),
          x,
          y,
          e.getClickCount(),
          e.isPopupTrigger(),
          ((MouseWheelEvent) e).getScrollType(),
          ((MouseWheelEvent) e).getScrollAmount(),
          ((MouseWheelEvent) e).getWheelRotation());
    } else {
      return new MouseEvent(
          (Component) e.getSource(),
          e.getID(),
          e.getWhen(),
          e.getModifiers(),
          x,
          y,
          e.getClickCount(),
          e.isPopupTrigger(),
          e.getButton());
    }
  }