Example #1
0
 static {
   NativeWindowFactory.initSingleton();
   NEWTJNILibLoader.loadNEWT();
   HINT_USE_MAIN_THREAD =
       !NativeWindowFactory.isAWTAvailable()
           || Debug.getBooleanProperty("newt.MainThread.force", true);
   osType = Platform.getOSType();
   isMacOSX = osType == Platform.OSType.MACOS;
   rootThreadGroup = getRootThreadGroup();
 }
Example #2
0
  static {
    NEWTJNILibLoader.loadNEWT();

    if (!initIDs0(X11Util.XERROR_STACKDUMP)) {
      throw new NativeWindowException("Failed to initialize X11Display jmethodIDs");
    }

    if (!WindowDriver.initIDs0()) {
      throw new NativeWindowException("Failed to initialize X11Window jmethodIDs");
    }
  }
Example #3
0
  static {
    NEWTJNILibLoader.loadNEWT();
    {
      final long[] _defaultIconHandle = {0, 0};
      if (DisplayImpl.isPNGUtilAvailable()) {
        try {
          final IOUtil.ClassResources iconRes = NewtFactory.getWindowIcons();
          {
            final URLConnection urlConn = iconRes.resolve(0);
            if (null != urlConn) {
              final PNGPixelRect image =
                  PNGPixelRect.read(
                      urlConn.getInputStream(),
                      PixelFormat.BGRA8888,
                      false /* directBuffer */,
                      0 /* destMinStrideInBytes */,
                      false /* destIsGLOriented */);
              _defaultIconHandle[0] =
                  DisplayDriver.createBGRA8888Icon0(
                      image.getPixels(),
                      image.getSize().getWidth(),
                      image.getSize().getHeight(),
                      false,
                      0,
                      0);
            }
          }
          {
            final URLConnection urlConn = iconRes.resolve(iconRes.resourceCount() - 1);
            if (null != urlConn) {
              final PNGPixelRect image =
                  PNGPixelRect.read(
                      urlConn.getInputStream(),
                      PixelFormat.BGRA8888,
                      false /* directBuffer */,
                      0 /* destMinStrideInBytes */,
                      false /* destIsGLOriented */);
              _defaultIconHandle[1] =
                  DisplayDriver.createBGRA8888Icon0(
                      image.getPixels(),
                      image.getSize().getWidth(),
                      image.getSize().getHeight(),
                      false,
                      0,
                      0);
            }
          }
        } catch (final Exception e) {
          e.printStackTrace();
        }
      }
      defaultIconHandles = _defaultIconHandle; // null is a valid value for an icon handle
    }
    sharedClassFactory =
        new RegisteredClassFactory(
            newtClassBaseName,
            WindowDriver.getNewtWndProc0(),
            false /* useDummyDispatchThread */,
            defaultIconHandles[0],
            defaultIconHandles[1]);

    if (!WindowDriver.initIDs0(RegisteredClassFactory.getHInstance())) {
      throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs");
    }
  }