src/npp_gate.cpp
NPError NPP_SetWindow (NPP instance, NPWindow* pNPWindow)
{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  if(pNPWindow == NULL)
    return NPERR_GENERIC_ERROR;

  Plugin * pPlugin = (Plugin *)instance->pdata;

  if(pPlugin == NULL)
    return NPERR_GENERIC_ERROR;

  if(!pPlugin->is_initialized()) {
    // window just created
    if(!pPlugin->Init(pNPWindow)) {
      delete pPlugin;
      pPlugin = NULL;
      instance->pdata = NULL;
      return NPERR_MODULE_LOAD_FAILED_ERROR;
    }
  }

  return NPERR_NO_ERROR;
}
// during this call we know when the plugin window is ready or
// is about to be destroyed so we can do some gui specific
// initialization and shutdown

during this call we know when the plugin window is ready or
is about to be destroyed so we can do some gui specific
initialization and shutdown
during this call we know when the plugin window is ready or is about to be destroyed so we can do some gui specific initialization and shutdown
NPError NPP_SetWindow (NPP instance, NPWindow* pNPWindow)
{
  if(instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;
  if(pNPWindow == NULL)
    return NPERR_GENERIC_ERROR;
  Plugin * pPlugin = (Plugin *)instance->pdata;
  if(pPlugin == NULL)
    return NPERR_GENERIC_ERROR;
  if(!pPlugin->is_initialized()) {
    if(!pPlugin->Init(pNPWindow)) {
      delete pPlugin;
      pPlugin = NULL;
      instance->pdata = NULL;
      return NPERR_MODULE_LOAD_FAILED_ERROR;
    }
  }
  return NPERR_NO_ERROR;
}
NPError NPP_SetWindow ( NPP instance , NPWindow * pNPWindow ) { if ( instance == NULL ) return NPERR_INVALID_INSTANCE_ERROR ; if ( pNPWindow == NULL ) return NPERR_GENERIC_ERROR ; Plugin * pPlugin = ( Plugin * ) instance -> pdata ; if ( pPlugin == NULL ) return NPERR_GENERIC_ERROR ; if ( ! pPlugin -> is_initialized ( ) ) { if ( ! pPlugin -> Init ( pNPWindow ) ) { delete pPlugin ; pPlugin = NULL ; instance -> pdata = NULL ; return NPERR_MODULE_LOAD_FAILED_ERROR ; } } return NPERR_NO_ERROR ; }
during this call we know when the plugin window is ready or
is about to be destroyed so we can do some gui specific
initialization and shutdown
during this call we know when the plugin window is ready or is about to be destroyed so we can do some gui specific initialization and shutdown
// window just created
