Open main menu

CDOT Wiki β

Changes

Mouse Lock Implementation FAQ

577 bytes added, 22:09, 17 November 2011
no edit summary
}
// doc is now an nsIDocument
</pre>
 
===How do I get from a Window (nsIDOMWindow) to a Widget (nsIWidget, nsBaseWidget, nsWindow, etc)?===
 
Answer: Given aWindow, see http://dxr.mozilla.org/mozilla/mozilla-central/toolkit/xre/nsNativeAppSupportUnix.cpp.html#l201
 
<pre>
nsCOMPtr<nsPIDOMWindow> domWindow(do_QueryInterface(aWindow));
if (!domWindow)
return NULL;
 
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(domWindow->GetDocShell());
if (!baseWindow)
return NULL;
 
nsCOMPtr<nsIWidget> widget;
baseWindow->GetMainWidget(getter_AddRefs(widget));
// widget is now your widget
</pre>