Example #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.swt.widgets.Widget#dispose()
   */
  @Override
  public void dispose() {
    if (androidInput != null) {
      androidInput.dispose();
    }

    if (currentSkinImage != null) {
      currentSkinImage.dispose();
    }

    Layout layout = getLayout();
    if (layout instanceof AndroidSkinLayout) {
      ((AndroidSkinLayout) layout).dispose();
    }

    skin = null;
    currentKey = null;
    keyListener = null;
    mainDisplayMouseListener = null;
    mainDisplayMouseMoveListener = null;

    if (!Platform.getOS().equals(Platform.OS_MACOSX)) {
      long hnd = androidInstance.getWindowHandle();
      if (hnd > 0) {
        NativeUIUtils.showWindow(hnd);
        NativeUIUtils.restoreWindow(hnd);
      }

      // Force update on redrawing
      androidInstance.setWindowHandle(0);
    }

    super.dispose();
  }
Example #2
0
  /**
   * This method is called when a mouse selection needs to be canceled. Pressing the right button,
   * releasing the left button or leaving the key area are examples of typical conditions.
   */
  private void cancelMouseSelection() {
    // If the mouse timer is different from null, that means that a key is
    // pressed
    // This check is important so that event messages are not sent by
    // mistake

    if (currentKey != null) {

      ImageData newImageData = getImageData(false, true);
      setSkinImage(newImageData, currentKey, true);
      androidInput.sendClick(currentKey.getKeysym(), false);
    }
  }