コード例 #1
0
  public void setCursorPosition(int x, int y) {
    try {
      // x,y corresponds to the location of the cursor's hotspot on the
      // screen
      // it can be anywhere in the screen area (but some part of the
      // cursor might not be visible)
      x = Math.min(Math.max(x, 0), graphics.getWidth() - 1);
      y = Math.min(Math.max(y, 0), graphics.getHeight() - 1);

      if ((cursorArea.getX() != x) || (cursorArea.getY() != y)) {
        hideCursor();

        if (cursorImage != null) {
          int newX = (int) (x - cursorImage.getHotSpotX());
          int newY = (int) (y - cursorImage.getHotSpotY());
          cursorArea.setLocation(newX, newY);
        } else {
          cursorArea.setLocation(x, y);
        }

        showCursor();
      }
    } catch (Throwable t) {
      Unsafe.debugStackTrace("error in setCursorPosition", t);
    }
  }
コード例 #2
0
  public void setCursorImage(HardwareCursor cursor) {
    if (cursor == null) {
      return;
    }

    try {
      final HardwareCursorImage cursImage = cursor.getImage(20, 20);

      if ((cursImage != null) && (this.cursorImage != cursImage)) {
        hideCursor();

        cursorArea.setSize(cursImage.getWidth(), cursImage.getHeight());
        if (cursorImage != null) {
          int newX =
              (int) (cursorArea.getX() + cursorImage.getHotSpotX() - cursImage.getHotSpotX());
          int newY =
              (int) (cursorArea.getY() + cursorImage.getHotSpotY() - cursImage.getHotSpotY());
          cursorArea.setLocation(newX, newY);
        }
        this.cursorImage = cursImage;

        showCursor();
      }
    } catch (Throwable t) {
      Unsafe.debugStackTrace("error in setCursorImage (" + t.getClass().getName() + ")", t);
    }
  }
コード例 #3
0
  public void setCursorVisible(boolean visible) {
    try {
      if (this.cursorVisible != visible) {
        this.cursorVisible = visible;

        if (visible) {
          showCursor();
        } else {
          hideCursor();
        }
      }
    } catch (Throwable t) {
      Unsafe.debugStackTrace("error in setCursorVisible", t);
    }
  }
コード例 #4
0
 /**
  * The entry point that used to run the 'application' when the isolate is started. The actual
  * command is then passed to us in a Link message in the form of a CommandRunner object.
  *
  * @param args
  */
 public static void main(String[] args) {
   Link cl = Isolate.getLinks()[0];
   CommandRunner cr;
   try {
     ObjectLinkMessage message = (ObjectLinkMessage) cl.receive();
     cr = (CommandRunner) message.extract();
     Map<String, String> env = cr.getEnv();
     int envSize = (env == null) ? 0 : env.size();
     byte[][] binEnv = new byte[envSize * 2][];
     if (envSize > 0) {
       int i = 0;
       for (Map.Entry<String, String> entry : env.entrySet()) {
         binEnv[i++] = entry.getKey().getBytes();
         binEnv[i++] = entry.getValue().getBytes();
       }
     }
     NativeProcessEnvironment.setIsolateInitialEnv(binEnv);
   } catch (Exception e) {
     Unsafe.debugStackTrace(e.getMessage(), e);
     return;
   }
   cr.run();
 }
コード例 #5
0
 /** Read a keystroke from the input. */
 @Inline
 private final int readKdbInput() {
   return Unsafe.readKdbInput();
 }
コード例 #6
0
 /** Print the given integer to the output. */
 @Inline
 private final void debug(int i) {
   Unsafe.debug(i);
 }
コード例 #7
0
 /** Print the given string to the output. */
 @Inline
 private final void debug(String str) {
   Unsafe.debug(str);
 }