private void onMouseMove(Player player, int dx, int dy, int x, int y) {
    // Mouse hasn't moved
    if (dx == 0 && dy == 0) {
      return;
    }

    Screen screen = getInputScreen();
    if (screen != null) {
      IntVector2 prev = new IntVector2(x - dx, y - dy);
      IntVector2 pos = new IntVector2(x, y);
      for (Widget w : screen.getWidgets()) {
        w.onMouseMoved(prev, pos, w == screen.getWidgetAt(x, y));
      }
    }

    // Mouse moved on x-axis
    if (!redirected) {
      if (dx != 0) {
        player.processCommand("dx", new ChatArguments(dx));
      }

      // Mouse moved on y-axis
      if (dy != 0) {
        player.processCommand("dy", new ChatArguments(dy));
      }
    }
  }
  private void onMouseClicked(Player player, Mouse button, boolean pressed, int x, int y) {
    PlayerClickEvent event =
        Spout.getEventManager()
            .callEvent(new PlayerClickEvent(player, button, pressed, new IntVector2(x, y)));
    if (event.isCancelled()) {
      return;
    }

    if (Spout.debugMode()) {
      Spout.log("Mouse clicked at {" + x + "," + y + "} was " + (pressed ? "pressed" : "released"));
    }

    Screen s = getInputScreen();
    if (s != null) {
      Widget w = s.getWidgetAt(x, y);
      if (w != null) {
        Widget fw = s.getFocusedWidget();
        if (fw != null && !fw.equals(w)) {
          s.setFocus(w, FocusReason.CLICKED);
        }
        w.onClicked(event);
      }
    }

    executeBindings(getMouseBindingsFor(button), player, pressed);
  }