1
#include <xpcom-config.h>
3
#include <nsIContent.h>
4
#include <nsIObserverService.h>
5
#include <nsStringAPI.h>
7
#include <nsComponentManagerUtils.h>
8
#include <nsIInterfaceRequestorUtils.h>
9
#include <nsServiceManagerUtils.h>
10
#include <nsIWidget.h>
11
#include <nsIWindowMediator.h>
12
#include <nsIBaseWindow.h>
13
#include <nsIXULWindow.h>
14
#include <nsIDOMWindowUtils.h>
15
#include <nsIDocShell.h>
16
#include <nsIDocShellTreeItem.h>
17
#include <nsIDocShellTreeOwner.h>
20
1
#include <glib-object.h>
21
2
#include <gdk/gdk.h>
22
3
#include <gdk/gdkx.h>
25
get_base_window_xid (nsCOMPtr<nsIBaseWindow> baseWindow)
8
get_base_window_xid (intptr_t pointer)
27
nsCOMPtr<nsIWidget> mainWidget;
28
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
32
GdkWindow *window = static_cast<GdkWindow *>(mainWidget->GetNativeData(NS_NATIVE_WINDOW));
10
GdkWindow *window = reinterpret_cast<GdkWindow *> (pointer);
36
15
window = gdk_window_get_toplevel(window);
38
17
return GDK_WINDOW_XID (window);
45
get_xid_for_outer_window_with_id (guint32 id)
47
nsCOMPtr<nsIWindowMediator> wm =
48
do_GetService("@mozilla.org/appshell/window-mediator;1");
53
nsCOMPtr<nsIDOMWindow> recentWindow;
54
wm->GetMostRecentWindow(NULL, getter_AddRefs(recentWindow));
59
nsCOMPtr<nsIDOMWindowUtils> domWindowUtils = do_GetInterface(recentWindow);
64
nsCOMPtr<nsIDOMWindow> windowWithID;
65
domWindowUtils->GetOuterWindowWithId(id, getter_AddRefs(windowWithID));
70
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(windowWithID);
75
nsIDocShell *docShell = pWindow->GetDocShell();
80
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = do_GetInterface(docShell);
82
if (!docShellTreeItem)
85
nsCOMPtr<nsIDocShellTreeOwner> docShellTreeOwner;
86
docShellTreeItem->GetTreeOwner(getter_AddRefs(docShellTreeOwner));
88
if (!docShellTreeOwner)
91
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(docShellTreeOwner);
96
return get_base_window_xid (baseWindow);