void MainWindow::SetWidget(Widget *_widget) { assert(_widget != NULL); restore_page_pending = false; /* delete the old widget */ KillWidget(); /* hide the map (might be hidden already) */ if (map != NULL) { map->FastHide(); #ifndef ENABLE_OPENGL if (!draw_suspended) { draw_suspended = true; draw_thread->BeginSuspend(); } #endif } if (bottom_widget != nullptr) bottom_widget->Hide(); widget = _widget; const PixelRect rc = GetMainRect(); widget->Initialise(*this, rc); widget->Prepare(*this, rc); widget->Show(rc); if (!widget->SetFocus()) SetFocus(); }
GlueMapWindow * MainWindow::ActivateMap() { restore_page_pending = false; if (map == NULL) return NULL; if (widget != NULL) { KillWidget(); map->Show(); map->SetFocus(); if (bottom_widget != nullptr) bottom_widget->Show(GetBottomWidgetRect(GetMainRect(), bottom_widget)); #ifndef ENABLE_OPENGL if (draw_suspended) { draw_suspended = false; draw_thread->Resume(); } #endif } return map; }
PluginWidgetParent::~PluginWidgetParent() { PWLOG("PluginWidgetParent::~PluginWidgetParent()\n"); MOZ_COUNT_DTOR(PluginWidgetParent); // A destroy call can actually get skipped if a widget is associated // with the last out-of-process page, make sure and cleanup any left // over widgets if we have them. KillWidget(); }
void MainWindow::OnDestroy() { timer.Cancel(); KillWidget(); KillBottomWidget(); SingleWindow::OnDestroy(); }
bool PluginWidgetParent::RecvCreate(nsresult* aResult) { PWLOG("PluginWidgetParent::RecvCreate()\n"); mWidget = do_CreateInstance(kWidgetCID, aResult); NS_ASSERTION(NS_SUCCEEDED(*aResult), "widget create failure"); #if defined(MOZ_WIDGET_GTK) // We need this currently just for GTK in setting up a socket widget // we can send over to content -> plugin. PLUG_NewPluginNativeWindow((nsPluginNativeWindow**)&mWrapper); if (!mWrapper) { KillWidget(); return false; } // Give a copy of this to the widget, which handles some update // work for us. mWidget->SetNativeData(NS_NATIVE_PLUGIN_OBJECT_PTR, (uintptr_t)mWrapper.get()); #endif // This returns the top level window widget nsCOMPtr<nsIWidget> parentWidget = GetTabParent()->GetWidget(); // If this fails, bail. if (!parentWidget) { *aResult = NS_ERROR_NOT_AVAILABLE; KillWidget(); return true; } nsWidgetInitData initData; initData.mWindowType = eWindowType_plugin_ipc_chrome; initData.mUnicode = false; initData.clipChildren = true; initData.clipSiblings = true; *aResult = mWidget->Create(parentWidget.get(), nullptr, nsIntRect(0,0,0,0), &initData); if (NS_FAILED(*aResult)) { KillWidget(); // This should never fail, abort. return false; } DebugOnly<nsresult> drv; drv = mWidget->EnableDragDrop(true); NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure"); #if defined(MOZ_WIDGET_GTK) // For setup, initially GTK code expects 'window' to hold the parent. mWrapper->window = mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT); drv = mWrapper->CreateXEmbedWindow(false); NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure"); mWrapper->SetAllocation(); PWLOG("Plugin XID=%p\n", (void*)mWrapper->window); #elif defined(XP_WIN) DebugOnly<DWORD> winres = ::SetPropW((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW), mozilla::dom::kPluginWidgetContentParentProperty, GetTabParent()->Manager()->AsContentParent()); NS_ASSERTION(winres, "SetPropW call failure"); #endif // This is a special call we make to nsBaseWidget to register this // window as a remote plugin window which is expected to receive // visibility updates from the compositor, which ships this data // over with corresponding layer updates. mWidget->RegisterPluginWindowForRemoteUpdates(); return true; }
void PluginWidgetParent::ActorDestroy(ActorDestroyReason aWhy) { PWLOG("PluginWidgetParent::ActorDestroy(%d)\n", aWhy); KillWidget(); }