NPError Private_SetWindow(NPP instance, NPWindow* window) { EnterCodeResource(); NPError rv = NPP_SetWindow(instance, window); ExitCodeResource(); return rv; }
void NetscapePlugin::callSetWindow() { if (wantsPluginRelativeNPWindowCoordinates()) { m_npWindow.x = 0; m_npWindow.y = 0; m_npWindow.clipRect.top = m_clipRect.y(); m_npWindow.clipRect.left = m_clipRect.x(); } else { IntPoint pluginLocationInRootViewCoordinates = convertToRootView(IntPoint()); IntPoint clipRectInRootViewCoordinates = convertToRootView(m_clipRect.location()); m_npWindow.x = pluginLocationInRootViewCoordinates.x(); m_npWindow.y = pluginLocationInRootViewCoordinates.y(); m_npWindow.clipRect.top = clipRectInRootViewCoordinates.y(); m_npWindow.clipRect.left = clipRectInRootViewCoordinates.x(); } m_npWindow.width = m_pluginSize.width(); m_npWindow.height = m_pluginSize.height(); m_npWindow.clipRect.right = m_npWindow.clipRect.left + m_clipRect.width(); m_npWindow.clipRect.bottom = m_npWindow.clipRect.top + m_clipRect.height(); NPP_SetWindow(&m_npWindow); m_hasCalledSetWindow = true; }
int16 VirtViewerXHandleEvent(NPP instance, void *event) { XGraphicsExposeEvent exposeEvent; XEvent *nsEvent; debug ("VirtViewerXHandleEvent"); nsEvent = (XEvent *) event; exposeEvent = nsEvent->xgraphicsexpose; /*printf(" event: x, y, w, h = %d, %d, %d, %d; display @ %p, window/drawable = %d\n", exposeEvent.x, exposeEvent.y, exposeEvent.width, exposeEvent.height, exposeEvent.display, exposeEvent.drawable);*/ windowlessWindow.window = exposeEvent.display; windowlessWindow.x = exposeEvent.x; windowlessWindow.y = exposeEvent.y; windowlessWindow.width = exposeEvent.width; windowlessWindow.height = exposeEvent.height; windowlessWindow.ws_info = (void *)exposeEvent.drawable; NPP_SetWindow(instance, &windowlessWindow); return 0; }
static NPError Private_SetWindow(NPP instance, NPWindow* window) { NPError err; PLUGINDEBUGSTR("SetWindow"); err = NPP_SetWindow(instance, window); return err; }
void NetscapePlugin::callSetWindowInvisible() { NPWindow invisibleWindow = m_npWindow; invisibleWindow.window = 0; invisibleWindow.clipRect.top = 0; invisibleWindow.clipRect.left = 0; invisibleWindow.clipRect.bottom = 0; invisibleWindow.clipRect.right = 0; NPP_SetWindow(&invisibleWindow); m_hasCalledSetWindow = true; }
void NetscapePlugin::callSetWindow() { #if PLUGIN_ARCHITECTURE(X11) // We use a backing store as the painting area for the plugin. m_npWindow.x = 0; m_npWindow.y = 0; #else m_npWindow.x = m_frameRect.x(); m_npWindow.y = m_frameRect.y(); #endif m_npWindow.width = m_frameRect.width(); m_npWindow.height = m_frameRect.height(); m_npWindow.clipRect.top = m_clipRect.y(); m_npWindow.clipRect.left = m_clipRect.x(); m_npWindow.clipRect.bottom = m_clipRect.maxY(); m_npWindow.clipRect.right = m_clipRect.maxX(); NPP_SetWindow(&m_npWindow); }
extern "C" NPError NPP_Destroy(NPP instance, NPSavedData** /*save*/) { _NPInstance* This; if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; This = (_NPInstance*) instance->pdata; if (This != NULL) { #ifdef _WS_WIN_ SetWindowLong( This->window, GWL_WNDPROC, (LONG)This->fDefaultWindowProc ); #endif if (This->widget) { This->widget->unsetWindow(); #ifdef _WS_WIN_ // needed? if (This->window) NPP_SetWindow( instance, 0 ); // unset #endif This->window = 0; delete This->widget; } delete This->instance; delete [] This->argn; delete [] This->argv; delete This; instance->pdata = NULL; instance_count--; } return NPERR_NO_ERROR; }
extern "C" NPError NPP_SetWindow(NPP instance, NPWindow* window) { if (!qNP) qNP = QNPlugin::create(); NPError result = NPERR_NO_ERROR; _NPInstance* This; if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; This = (_NPInstance*) instance->pdata; if (!window) { if (This->widget) { This->widget->unsetWindow(); This->window = 0; delete This->widget; This->widget = 0; } #ifdef _WS_X11_ } else if (This->window != (Window) window->window) { if (This->window) NPP_SetWindow( instance, 0 ); // unset This->window = (Window) window->window; #endif #ifdef _WS_WIN_ } else if (This->window != (HWND) window->window) { if (This->window) SetWindowLong( This->window, GWL_WNDPROC, (LONG)This->fDefaultWindowProc ); This->fDefaultWindowProc = (WNDPROC)GetWindowLong( (HWND)window->window, GWL_WNDPROC); This->window = (HWND) window->window; #endif This->x = window->x; This->y = window->y; This->width = window->width; This->height = window->height; #ifdef _WS_X11_ This->display = ((NPSetWindowCallbackStruct *)window->ws_info)->display; #endif if (!piApp) { #ifdef _WS_X11_ if (!qApp) { // Thou Shalt Not Unload Qt // Increment the reference count... // dlopen("libqt.so.1", RTLD_LAZY); // ... and never close it. // Nice try. Can't get that to work. // We are the first Qt-based plugin to arrive new QApplication(This->display); //XSynchronize(This->display,True); // Helps debugging ASSERT(qt_np_count == 0); } installXtEventFilters(Safe); qt_np_add_timeoutcb(np_do_timers); qt_np_add_timer_setter(np_set_timer); qt_np_add_event_proc(np_event_proc); qt_np_count++; appcon = XtDisplayToApplicationContext(This->display); #endif piApp = new PluginSDK_QApplication(); } if (!This->widget) { #ifdef _WS_WIN_ This->window = (HWND) window->window; InvalidateRect( This->window, NULL, TRUE ); UpdateWindow( This->window ); #endif // New widget on this new window. next_pi = This; /* This->widget = */ // (happens sooner - in QNPWidget constructor) This->instance->newWindow(); This->widget->show(); } else { // New window for existing widget, and all its children. This->widget->setWindow(FALSE); } } else if (This->widget) { // ### Maybe need a geometry setter that bypasses some Qt code? // ### position is always (0,0), so we get by by ignoring it. //This->widget->setGeometry(window->x,window->y, window->width, window->height); if ( This->widget->width() != (int)window->width || This->widget->height() != (int)window->height ) { //#ifdef _WS_WIN_ //This->widget->setGeometry(window->x, window->y, window->width, window->height); //#else This->widget->resize(window->width, window->height); //#endif } else { This->widget->update(); } } This->fWindow = window; return result; }
NPError Private_SetWindow(NPP instance, NPWindow* window) { NPError rv = NPP_SetWindow(instance, window); return rv; }