Program: 96839
Project: 96839
Buggy source:
public GwtInputDevice(){
  createKeyMapping();
  createMouseMapping();
  Canvas canvas=((GwtDisplayDevice)SilenceEngine.display).canvas;
  canvas.addKeyDownHandler(event -> {
    postKeyEvent(getKeyCode(event.getNativeKeyCode()),true);
    event.preventDefault();
  }
);
  canvas.addKeyUpHandler(event -> {
    postKeyEvent(getKeyCode(event.getNativeKeyCode()),false);
    event.preventDefault();
  }
);
  canvas.addMouseDownHandler(event -> {
    postMouseEvent(getMouseCode(event.getNativeButton()),true);
    event.preventDefault();
  }
);
  canvas.addMouseUpHandler(event -> {
    postMouseEvent(getMouseCode(event.getNativeButton()),false);
    event.preventDefault();
  }
);
  canvas.addMouseMoveHandler(event -> {
    int x=event.getX();
    int y=event.getY();
    Mouse.dx=x - Mouse.x;
    Mouse.dy=y - Mouse.y;
    Mouse.x=x;
    Mouse.y=y;
    event.preventDefault();
  }
);
  canvas.addMouseWheelHandler(event -> {
    int dsy=event.getDeltaY();
    Mouse.deltaScrollY=dsy > 0 ? 1 : dsy == 0 ? 0 : -1;
    Mouse.deltaScrollX=0;
    event.preventDefault();
  }
);
  canvas.addTouchStartHandler(event -> {
    postTouchEvents(event.getTargetTouches(),true);
    event.preventDefault();
  }
);
  canvas.addTouchMoveHandler(event -> {
    postTouchEvents(event.getTargetTouches(),true);
    event.preventDefault();
  }
);
  canvas.addTouchEndHandler(event -> {
    postTouchEvents(event.getTargetTouches(),false);
    event.preventDefault();
  }
);
  canvas.addTouchCancelHandler(event -> {
    postTouchEvents(event.getTargetTouches(),false);
    event.preventDefault();
  }
);
  preventContextMenu(canvas.getCanvasElement());
}

Fixed version (ground truth):
public GwtInputDevice(){
  createKeyMapping();
  createMouseMapping();
  Canvas canvas=((GwtDisplayDevice)SilenceEngine.display).canvas;
  canvas.addKeyDownHandler(event -> {
    postKeyEvent(getKeyCode(event.getNativeKeyCode()),true);
    event.preventDefault();
  }
);
  canvas.addKeyUpHandler(event -> {
    postKeyEvent(getKeyCode(event.getNativeKeyCode()),false);
    event.preventDefault();
  }
);
  canvas.addMouseDownHandler(event -> {
    postMouseEvent(getMouseCode(event.getNativeButton()),true);
    canvas.setFocus(true);
    event.preventDefault();
  }
);
  canvas.addMouseUpHandler(event -> {
    postMouseEvent(getMouseCode(event.getNativeButton()),false);
    event.preventDefault();
  }
);
  canvas.addMouseMoveHandler(event -> {
    int x=event.getX();
    int y=event.getY();
    Mouse.dx=x - Mouse.x;
    Mouse.dy=y - Mouse.y;
    Mouse.x=x;
    Mouse.y=y;
    event.preventDefault();
  }
);
  canvas.addMouseWheelHandler(event -> {
    int dsy=event.getDeltaY();
    Mouse.deltaScrollY=dsy > 0 ? 1 : dsy == 0 ? 0 : -1;
    Mouse.deltaScrollX=0;
    event.preventDefault();
  }
);
  canvas.addTouchStartHandler(event -> {
    postTouchEvents(event.getTargetTouches(),true);
    event.preventDefault();
  }
);
  canvas.addTouchMoveHandler(event -> {
    postTouchEvents(event.getTargetTouches(),true);
    event.preventDefault();
  }
);
  canvas.addTouchEndHandler(event -> {
    postTouchEvents(event.getTargetTouches(),false);
    event.preventDefault();
  }
);
  canvas.addTouchCancelHandler(event -> {
    postTouchEvents(event.getTargetTouches(),false);
    event.preventDefault();
  }
);
  preventContextMenu(canvas.getCanvasElement());
}